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

Cutting Strings 1

Status
Not open for further replies.

olli2003

Technical User
Jan 31, 2003
93
DE
Hi!

I'd like to cut a whole string to filter just one word to save it in a new file.

F. ex.

the whole string is:
ANR1163W Offsite volume 000535 still contains files

Now I want to save just one word (in this case it's
000535) in a new file.

ANR1163W Offsite volume 000353 still contains files

(in this case 000353) and so on...

How it's possible to do?

Thanks a lot for your help!

Regards
Oliver
 
Hello p5wizard

Thanks a lot! That's working for the first time - fine!
Now I've this output:

000535
000353

I've saved in a sepearte file.

My second problem's, that I want to fetch out of this
new file string by string to put them in an executable - in a command.

F. ex.

The next step must be:

move data 000535 to tape...

(If this job is finished, the next string must fetch out of the file ->

move data 000353 to tape...

and so on... It's really difficult to explain -
do you understand?


Thanks and Best Regards
Oliver
 
Well then...

from your original file

awk '{print "move data",$4,"to tape..."}'

or

awk '{printf "move data %s to tape...", $4}'


Use whatever text you like in the quoted strings or the printf format string...

Lookup the man page for awk on your system or on the web for more info...


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top