awk script question

Kurt Wall kwall
Mon Sep 6 09:08:37 PDT 2004


In a 1.4K blaze of typing glory, Shawn Tayler wrote:
> Hi Guys,
> 
> This is an awk script that I have been toying with.  Its supposed to send
> the appropriate lines to the appropriate files.  Everything I can find in
> my awk docs and online seems to say that this will work.  What am I
> missing?
> 
> BEGIN { FS = "," } # comma delimited fields
> { OFS = "," }
> #{ print $1 "," $3 }
> $1 < 3000 { print $1  $2 } >> "1"
> $1 >= 4000 && $1 <= 11999 { print $1  $2 } >> "1"
> $1 >= 3000 && $1 <= 3999 { print $1  $2 } >> "2"
> $1 >= 6900 && $1 <= 6999 { print $1 $2 } >> "3"
> $1 >= 12000 && $1 <= 12499 { print $1  $2 } >> "4"
> $1 >= 12500 && $1 <= 12575 { print $1 $2 } >> "5"
> $1 >= 12576 && $1 <= 12619 { print $1 $2 } >> "6"
> $1 >= 12620 && $1 <= 12740 { print $1 $2 } >> "7"
> $1 >= 12741 && $1 <= 13199 { print $1 $2 } >> "8"
> $1 >= 13200 && $1 <= 13399 { print $1 $2 } >> "9"
> $1 >= 13400 && $1 <= 13499 { print $1 $2 } >> "10"
> $1 >= 13500 && $1 <= 13999 { print $1 $2 } >> "11"
> $1 >= 14000 && $1 <= 14499 { print $1 $2 } >> "12"
> $1 >= 14500 && $1 <= 15851 { print $1 $2 } >> "13"
> $1 >= 15852 && $1 <= 16049 { print $1 $2 } >> "15"
> $1 >= 16050 && $1 <= 16124 { print $1 $2 } >> "16"
> $1 >= 16125 && $1 <= 16174 { print $1 $2 } >> "17"
> $1 >= 16175 && $1 <= 16224 { print $1 $2 } >> "18"
> $1 >= 16225 && $1 <= 16274 { print $1 $2 } >> "19"
> $1 >= 16275 && $1 <= 16374 { print $1 $2 } >> "20"

What result are you getting? What does the input file look like?

Kurt
-- 
The best cure for insomnia is to get a  lot of sleep.
	-- W. C. Fields


More information about the Linux-users mailing list