From: Mark Webb (mark.webb at domain Trintech.com)
Date: Wed 29 Aug 2001 - 13:47:46 IST
hrishy wrote:
>
> This is the text file opn which i run the awk script
>
> awk script is
>
> BEGIN {
> prev_table="."
> }
> {
> curr_table=$1
> if ( curr_table!=prev_table )
> {
> prev_table=curr_table
> printf("\nTable %s : %s",$1,$2)
> }
> else
> {
> printf(",%s",$2)
> }
> }
>
> i get the output but can u please explain the if loop.
$0 is the whole line in awk.
$1 is column 1, $2 column 2, etc.
You may override the Field separator by setting FS.
-Mark.
P.S. Some tabs in that awk program would be nice...
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:11:53 GMT