Will Shiver wrote: > > I have a file that I would like to read thru line by > line and print somthing based on when the value in > the first field postion stays the same. I would change > the tag value amongst 3 different values. > > Example file: > blue jay > blue bery > blue bird > red apple > red car > red man > purple people > green > green 2 > green 3 > black one > black woman > > The Program would > split on space > field position 1 would equal blue and it would then print > blue box > blue box > blue box > red robo > red robo > red robo > purple rain > green box > green box > green box > black robo > black robo
perl -lane'$a{$F[0]}++or$a=qw/box robo rain/[$b++%3];print"$F[0] $a"' yourfile.txt John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]