Home > Archive > AWK > March 2008 > file not found
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| happytoday 2008-03-10, 4:01 am |
| I am piping sed command to an awk program but I got that error
message :
# sed -f namestate list | bystate
ksh: bystate: not found
#
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
}'
| |
| Joel Reicher 2008-03-10, 4:01 am |
| happytoday <ehabaziz2001@gmail.com> writes:
> I am piping sed command to an awk program but I got that error
> message :
> # sed -f namestate list | bystate
> ksh: bystate: not found
> #
>
> Though bystate is a chmod 777 and contain that commands :
The shell is telling you bystate hasn't been found, not that execute
permission is denied.
It most probably isn't in your path (and shouldn't be if it's just the
current directory). Try ./bystate
Cheers,
- Joel
| |
| Ed Morton 2008-03-10, 7:58 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.
| |
| happytoday 2008-03-10, 10:01 pm |
| On Mar 10, 2:32=A0pm, Ed Morton <mor...@lsupcaemnt.com> wrote:
> On 3/10/2008 1:13 AM, happytoday wrote:
>
>
> 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 im=
prove
> your awk script...
>
>
>
>
>
>
>
> ... |
> awk -F, '
> $1 !=3D LastState { LastState =3D $1; print $1 }
> { print "\t" $2 }
> '
>
> =A0 =A0 =A0 =A0 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 =3D=3D LastState {
print "\t" $2
}
$1 !=3D LastState {
LastState =3D $1
print $1
print "\t" $2
| |
| Ed Morton 2008-03-10, 10:01 pm |
|
On 3/10/2008 3:46 PM, happytoday wrote:
> On Mar 10, 2:32 pm, Ed Morton <mor...@lsupcaemnt.com> wrote:
>
>
>
> 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.
|
|
|
|
|