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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using AWK within a CSH

Status
Not open for further replies.

apedosmil8

IS-IT--Management
Dec 2, 2007
6
US
How do I run AWK in CSH?

Thanks
 
Your question is not very clear. Generally, awk is used in csh the same way it is in sh/ksh. Can you be a little more specific?
 
I am running a csh script that runs and does various things. I finally want to do some multiplication.

This is the code I need to run within my csh file.

{
Totals[$5] += $3*$4
}
END {
for (x in Totals)
print i, Totals
}

Right now I have to run this on a separate file for it to work. So once I run my ./csh file. I think have to run this awk file by doing

awk -f AWK csh

to get my final results, I want AWK to be done in my CSH file so I only use one file.

Thanks
 
This is where I would start (script.csh):
Code:
...
csh code
...
more csh code
...
final csh code that produces the list|awk '{awk main program here} END{awk end program here}'

or a script wrapper (wrapper.csh with awk that invokes your other script and runs awk on the output):

Code:
script.csh|awk '{...} END{...}'


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top