Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gawk with WinXP not sure where to post

Status
Not open for further replies.

jjohnn

Technical User
Feb 11, 2003
43
US
I am trying to run the first awk script in O'Reilly's Sed and Awk, using a .bat file instead of Unix shell script. The script only works if it is on a single line in the .bat file.

Original unix script:
gawk -F, '{
print $4 \", \" $0
}' $* |
sort | gawk -F, '$1==LastState{
print \"\t\" $2
}
$1!=LastState {
LastState=$1
print $1
print \"\t\" $2
}'

My script that works, but only on one line:
gawk -F, "{ print $4 \", \" $0}" |sort | gawk -F, "$1==LastState{print \"\t\" $2;} $1!=LastState {LastState=$1; print $1; print \"\t\" $2;}"

Called with:
C:> sed -f namestate list | script2

I have sed, awk, and sort installed as separate .exe's.

This is driving me crazy trying to fix this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top