On Tue, Mar 29, 2011 at 08:58:43AM +0530, Rony wrote:
In the page
http://docstore.mik.ua/orelly/unix/sedawk/ch02_05.htm
I followed the instructions to create a file called nameState and byState. The earlier sample commands with nameState work. I can also 'cat byState' and see the contents too. But when I run their sample command
|sed -f nameState list | byState
I get the error: byState: command not found
Even while typing the command itself, after the pipe, the byS does not auto complete giving a indication of a problem. What could this be? I can work with the file individually but after the pipe it does not show up. I can even do awk '{ print $0 }' byState and display the file contents.
This is my byState:
#! /bin/sh awk -F, '{ print $4 ", " $0 }' $* | sort | awk -F, ' $1 == LastState { print "\t" $2 } $1 != LastState { LastState = $1; print $1 }'
And this works:
chmod +x ./byState sed -f nameState list | ./byState
HTH.
Kumar