The UNIX and Linux Forums  

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-17-2006
jerome_1664 jerome_1664 is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 2
Split a huge line into multiple 120 characters lines with sed?

Hello ,

I'm trying to split a file which contains a single very long line.
My aim is to split this single line each 120 characters.

I tried with the sed command :
`cat ${MYPATH}/${FILE}|sed -e :a -e 's/^.\{1,120\}$/&\n/;ta' >{MYPATH}/${DEST}`

but when I wc -l the destination file it is still a 1 line file hu.
my original file is a 0 line file as it doesn't contain any CR/LF.

Can some one help me with this sed syntax to make it work pls?

Thanks in advance!

Jerome.