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 -->
  #4 (permalink)  
Old 12-08-2006
grinder182533 grinder182533 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 17
sed solution

Thanks Anbu23
When I posted yesterday, I simplified my problem, thinking that I could follow your logic, and apply it to my actual problem.
In fact, it is line 5 position 32 before which the CR/LF is to be inserted.
The new line 6 will contain fixed text from position 1 to 31 inclusive, (X)
and position 32 to 34 from line 5 will be dropped down to the same positions on line 6.
I tried
sed "5 s/\(...\).\(.*\)/\1\\
X \2/" $file > tmp
but this still spilt after 3 characters.

I tried
sed "5 s/\(.............................\).\(.*\)/\1\\
X \2/" $file > tmp
but got a syntax error.
Hope you can further help.
Thanks