CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum

Search and Replace related

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   March 30, 2005, 11:05
Default Search and Replace related
Posts: n/a
Hi, I have an input file (input.txt): ====== # The four columns represent Name, Country, Age and # City respectively.

John China 28 Beijing Matt USA 40 San-Francisco Cathy Englan 50 London .. .. ..

====== I have a Master template file (Master.txt): ----- $Name is from $Country. $Name is $Age years old, and comes from $City. ======

For each row (person) in the input file, I would like a new output to be produced with the filename $Name.txt, which is based on the Master.txt template.

Can someone show how this is easily done. (I was told that gawk/awk (or sed) could do it easily, but I am not very familiar with them yet, and I did not find a similar example in the User Guide for GAWK.) Thanks.
  Reply With Quote

Old   March 30, 2005, 11:12
Default Re: Search and Replace related
Posts: n/a
BTW, The input file looks a little distorted when this is posted here. It should be:

(On Row 1) John China 28 Beijing

(On Row 2) Matt USA 40 San-Francisco

(On Row 3) Cathy Englan 50 London



  Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -4. The time now is 19:51.