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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
replacing multiple lines with single line siba.s.nayak Shell Programming and Scripting 3 05-28-2008 02:43 AM
Splitting the line in multiple lines dd_sh Shell Programming and Scripting 3 03-31-2008 01:54 PM
using tr to put multiple lines of output into one line otes4 Shell Programming and Scripting 3 02-18-2008 11:30 AM
Split data into multiple lines kingofprussia UNIX for Dummies Questions & Answers 5 07-31-2007 01:48 PM
Splitting a single line into multiple lines thanuman Shell Programming and Scripting 4 02-23-2005 04:56 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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.
  #2 (permalink)  
Old 08-17-2006
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
look into 'man fold'
  #3 (permalink)  
Old 08-17-2006
jerome_1664 jerome_1664 is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 2
Thanks a lot for this command vgersh99!
I never heard about it ^^

It works perfectly!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:26 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0