csh scripting and awk?
Hi, I'm trying to write a csh script (for all you csh haters, this is a task i was given in my college studies) and in that script I want to use awk. the problem is, that in the pattern in awk, there is the $1, $2, $3 (...) variables, representing fields of the file / input. Also, in csh scripting, there are $1, $2, $3 (...) variables, representing arguments for the script.
What I want to do is to compare the second field of the awk input to the third argument of the script, but that does some problem - lets say, Code:
#!/bin/csh Do you know of any solutions for this problem? |
how about something like
Code:
awk $3' ~ $2' somefile |
Quote:
|
alright, found it. it is possible to do:
awk -v expression=$3 '$2 ~ expression' file a pretty nice way. if you know any other ways, more elegants and such, you are free to give a comment ;) |
All times are GMT -5. The time now is 10:16 PM. |