On Tuesday 29 March 2011 10:42 AM, Kumar Appaiah wrote:
> 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

So I needed a ./byState along with the +x which I had done. I did that 
with the script from the site and at least it worked but gave a syntax 
error.

> sed -f nameState list | ./byState
>
>

Thanks Kumar.

After I copied your script in byState it works. The difference was with 
some spaces. It looks like the site's scripts are not formatted and 
printed properly and they don't give any instructions on the extra 
steps. Becomes difficult for learners as more time is spent correcting 
their lapses.


-- 

As a proper list etiquette.....
Please trim your replies. Avoid cross posting to other lists.
Members do not want to waste time answering same queries that may have been 
answered on other lists.
Replies from other lists, to cross posted mails are not available to our 
members.
Post your replies below the relevant original text, leaving a line space.
Do not re-use old messages to write new ones. For new messages, create a new 
message.

Regards,

Rony.

-- 
http://mm.glug-bom.org/mailman/listinfo/linuxers

Reply via email to