Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: file not fo...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 5 Topic 2183 of 2236
Post > Topic >>

Re: file not found

by Ed Morton <morton@[EMAIL PROTECTED] > Mar 10, 2008 at 03:56 PM

On 3/10/2008 3:46 PM, happytoday wrote:
> On Mar 10, 2:32 pm, Ed Morton <mor...@[EMAIL PROTECTED]
> wrote:
> 
>>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.- Hide quoted text -
>>
>>- Show quoted text -
> 
> 
> Can I know How can I implement that command with Dos versions:
> 
> # sed -f namestate list | bystate
> 
> How can I convert that script to be run under awk95.exe
> 
> 
> # 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

You need to ask in a DOS group as you're asking how to call awk in a pipe
with
multiple OS-specific programs and so that has nothing to do with the awk
language as discussed in this NG.

Alternatively, drop the OS-specific part (mainly the call to UNIX sort)
and
rewrite it in GNU awk which has built in sort functions and will, I
believe, run
on both DOS and UNIX. If you post some small sample input and expected
output
someone could probably help you write a GNU awk script.

	Ed.




 5 Posts in Topic:
file not found
happytoday <ehabaziz20  2008-03-09 23:13:22 
Re: file not found
Joel Reicher <joel@[EM  2008-03-10 07:19:52 
Re: file not found
Ed Morton <morton@[EMA  2008-03-10 07:32:38 
Re: file not found
happytoday <ehabaziz20  2008-03-10 13:46:48 
Re: file not found
Ed Morton <morton@[EMA  2008-03-10 15:56:45 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 2:46:04 CDT 2008.