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
replace a character with another character satish@123 Shell Programming and Scripting 8 05-13-2009 03:04 PM
Replace certain character with a new a new line. djsal Shell Programming and Scripting 8 01-11-2008 12:59 PM
Replace a character in last line Mohammed Shell Programming and Scripting 6 08-01-2007 02:46 PM
replace character with tr tmxps UNIX for Dummies Questions & Answers 3 09-29-2005 07:32 AM
How would I replace the 9th character of every line in a file? LordJezo Shell Programming and Scripting 5 09-01-2004 11:51 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-11-2008
chan chan is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 3
to replace a new line character

sample I/p:


S12J LLL
H77K PPP
J25O LOP
I73S lOP
K99O PLO

Required O/p:


S12J LLL H77K PPP J25O LOP I73S lOP K99O PLO

how to replace a new line character with space using sed command only


Cheers,
Chan
  #2 (permalink)  
Old 01-11-2008
funksen funksen is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 430
Code:
 sed -e 'H;1h;$!d;g;y/\n/ /' file
or

Code:
cat file  | tr '\n' ' '
  #3 (permalink)  
Old 01-11-2008
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,512
Quote:
Originally Posted by funksen;302157564
[code
cat file | tr '\n' ' '[/code]
Code:
tr '\n' ' ' < file
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 04:31 AM.


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