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!

sed query

Status
Not open for further replies.

ianholmes

Programmer
Mar 24, 2001
61
GB
I have a series of folders /temp/a /temp/b /temp/c

In folders a, b, and c, I have files
a1.txt……….a20.txt
b1.txt……….b40.txt &
c1.txt……….c60.txt

Each file has the same data format :-

Line 1 AAAAA aaaa
Line 2 BBB bbbbbb
Line 3 CCCC cccccc
Etc etc

I need to write a sed script which will go through all the files and reformat the data thus :-

Line 1 AAAAA aaaa
Line 2 BBB
Line 3 X bbbbbb
Line 4 CCCC cccccc
Etc etc

So I need to insert a CR/LF in line 2 position 4,
create a new Line 3 with a constant text (X) and the value of what was to the right of the previous Line 2 (bbbbbb)
and move the remaining lines one line down.

Can anyone help please ?
I don't know sed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top