C shell script issues
Hi,
I'm running RedHat 9.0. I have a C shell script that calls an awk program: gawk -f awkProg temp.txt temp.txt has (among others) the following lines: Max Value = 12343.3434 blah Max Value = 23423.234 blah my awk program has the following BEGIN statement: BEGIN { FS = " " } /^Max/ { scaleArray[i++] = $4 } END { here, I just find the max value in scaleArray[] } so there are no 'print's in this right? right. But, when I execute 'gawk -f awkProg temp.txt' I get all the matches printed out to Standard Out Max Value = 12343.3434 Max Value = 23423.234 ... and so on. How did this happen!?!?!? AND here's a second question. In my C shell script I'm running a program which generates the above 'Max Value' value. After the program generates all the 'Max Value''s it goes on to do 'other' stuff and all output is redirected to temp.txt. Can I use grep or awk from within the shell script to stop this program (by using Ctrl-C) to prevent it from doing it's 'other' stuff?? This would speed up the script significantly. Cheers -Dave:Pengy: |
"How did this happen!?!?!?"
By any chance do you have a trap command in the script which sets the debug option? ___________________________________ Be prepared. Create a LifeBoat CD. http://users.rcn.com/srstites/LifeBo...home.page.html Steve Stites |
"Can I use grep or awk from within the shell script to stop this program (by using Ctrl-C) to prevent it from doing it's 'other' stuff?? This would speed up the script significantly. "
Possibly. Another possibility is the have the subprogram direct its output to /dev/null instead of temp.txt. Or you could write a second version of the subprogram which does not include the "other stuff" ___________________________________ Be prepared. Create a LifeBoat CD. http://users.rcn.com/srstites/LifeBo...home.page.html Steve Stites |
Probably the easiest way is to
Code:
sed '/When i see this line I end the reading of input and stop/Q' the problem as is, but one thing is your spurious use of newlines (probably in places where they are not allowed) case 1: Code:
/foo/ case 2: Code:
/foo/ { |
All times are GMT -5. The time now is 12:38 PM. |