Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
awk script needed
Name: pauljohny Date: October 3, 2005 at 09:46:41 Pacific OS: unix CPU/Ram: 16g
Comment:
Hi,
I am trying to find an awk command or an unix script equivalent to do the following.
I have the following txt file
1234 script.sh param1 param2 2345 script2.sh param1 param2 ... and so on
I want something that would read the above file. run the script with the parameters. Grep through the results from the script for the word not running and in case the word is present write the first field (eg 1234) into an output file.
The script has to iterate through the whole file and do this. Any ideas on how I can do it? I am trying to figure a way using awk but in vain...
Name: nails Date: October 3, 2005 at 12:31:26 Pacific
Reply:
Here is a way:
#!/bin/ksh
while read line do set - $(echo $line) cmdstr=$2 cnt=2 while (( $cnt < $# )) do ((cnt=cnt+1)) eval var=$(echo \$${cnt}) cmdstr="$cmdstr $var" done cmdstr="$cmdstr > $1" eval "$cmdstr" done < data.file # end script
read each line use set to parse the line build the command line execute the command using eval.
Summary: William was kind enough to help me with the following awk script to convert fields into vCal standard items. It works beautifully in testing, but I cannot get the program I use to output 24h time,...
Summary: I'm afraid my problem needs a bit more tweaking. That's because it needs to accomodate multiple occurances of entities of the same name. If you can possibly help, please take a look at the following...