by Ed Morton <morton@[EMAIL PROTECTED]
>
Mar 10, 2008 at 07:32 AM
On 3/10/2008 1:13 AM, happytoday wrote:
> I am piping sed command to an awk program but I got that error
> message :
> # sed -f namestate list | bystate
> ksh: bystate: not found
> #
That has nothing to do with awk so you should post the question to
comp.unix.shell or similair. Having said that, below is a suggestion to
improve
your awk script...
> Though bystate is a chmod 777 and contain that commands :
>
> # cat bystate
> #!/bin/sh
> awk -F, '{
> print $4 ", " $0
> }' $* |
> sort |
> awk -F, '
> $1 == LastState {
> print "\t" $2
> }
> $1 != LastState {
> LastState = $1
> print $1
> print "\t" $2
> }'
.... |
awk -F, '
$1 != LastState { LastState = $1; print $1 }
{ print "\t" $2 }
'
Ed.