The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: sed query
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 12-07-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Does this work?
Code:
awk '{if(NR==2) print $1,"\nX",$2; else print}' filename > filename.new
mv filename.new filename
Run this through a loop on each file.

Note that I have assumed that the text in your files is just as you are showing it (exactly the same number and location of space characters to be specific). Even if it isn't you just need to change the awk a bit.