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

Newbie - Inserting text into 3 files

Status
Not open for further replies.

lamos

Technical User
Apr 4, 2004
2
US
Hi folks,

I'm trying to insert some text strings (defined from a variable, e.g, STRING="123XYZ-X") into the first two files of three. The 3rd is a simple locate and replace.

For example:

The X string is what I would like to insert for File1

File1:
AAAAAAAAAAAAAAAAAA
XXXXXXXXXXXXXXXXXXXXX
AAAAAAAAAAAAAAAAAAAAAAAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXX

In file 2, I'd like to insert W and X

File2:
WAAAAAAAAAAAAAAAAAAAAAAAAAAAA
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX

File3:

AAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAA
...
AAAA <---remove and replace with BBBBBB
CCCCCC
DDDDDD


I tried with both awk and "here document" with no success.

Thanks for your help in advance.
 
Could you be more precise ?
For each file show us :
- the file before
- the criterion of modification
- the file after , use the value you give as example "123XYZ-X"

Jean Pierre.
 
Sure,

What I'm trying to do is create a menu driven system that would allow me to modify Netscape instances. There are 3 files that need to be modified. I'd like to add the different strings, for example, in file1, I wish to insert the X and Y string based on what was enter under the ksh (menu) read statement as such (desired output).

AAAAA
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYYYYYYYYYYYY


In the second file2, I would like to insert a # sign int front of the A string as such and enter the same X string above underneath the string of As:

AAAAAAA

#AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

For the 3rd file3:
I wish to delete the last string in the file, XYZ, and replace it with 3 strings of my choice.

All this should be entered in the menu to affect the changes on all 3 files.

Thanks for your help.
 
lamos, nobody here can read into your mind nor have crystal bowl.
So if you want some help ask understandable question.
Please, follow the link in my signature and read carefully .

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top