CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Search and Replace related

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2005, 12:05
Default Search and Replace related
  #1
Sha
Guest
 
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, 12:12
Default Re: Search and Replace related
  #2
Sha
Guest
 
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

Reply


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 Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 08:02.