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!

Hi, I'm having problems creating

Status
Not open for further replies.

jamdee

IS-IT--Management
Aug 18, 2003
3
US
Hi,

I'm having problems creating an awk script that searches in a file with "FULL" and "FROZEN in the $9 then sends that to a newfile called tapelist, then doing a reading that file to execute a command on all the tapes in the $1 of the newfile, tapelist. I've tried many things and here is the latest...

awk '/FULL/ {print $1, $9} > tapelist'
awk ' ( (getline tape < &quot;tapelist ) > 0 )
cd /directory
./command
'

Please help...
jamdee

 
# you'll have to decide what you want to do from this point on
nawk '$9 ~ /(FULL|FROZEN)/ {print $1}' myFile.txt

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hey thanks..that did the job to create the file that has only tapes that are full or frozen. I'm now trying to use getline or a loop that runs a command on all the tapes ($1) in the new file until end of list.
Again, I've tried different methods, but still not working. Please understand that I am new to using awk and just trying to learn. Please help..Thanks.
 
nawk '$9 ~ /(FULL|FROZEN)/ {print $1}' myFile.txt | while read tape junk
do
whateverCommand2run &quot;${tape}&quot;
done;

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hi ..thanks for your timely response and I appreciate your help....Here is what I have so far...

nawk '$9 ~ /FULL/ {print $1} daylist > newf|while read tape
do
cd /usr/openv/netbackup/bin/admincmd
./bpexpdate -ev &quot;${tape}&quot; -host grouper -d 0
done;
'

and here is the error
nawk: syntax error at source line 1
context is
$9 ~ /FULL/ {print $1} daylist > >>> newf| <<< while read tape
nawk: bailing out at source line 1
 
pay attention to the posts:

nawk '$9 ~ /FULL/ {print $1}' daylist |while read tape
do
cd /usr/openv/netbackup/bin/admincmd
./bpexpdate -ev &quot;${tape}&quot; -host grouper -d 0
done;

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top