substitute \n by space | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

substitute \n by space

Shell Programming and Scripting


Tags
bash, newline reg-ex, sed newline

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-10-2008
GDVS GDVS is offline
Registered User
 
Join Date: Dec 2008
Last Activity: 11 December 2008, 9:44 AM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
substitute \n by space

I'm writing a bash script that is supposed to turn a particular xml into xhtml. I'm using pipelines in between regular expressions (sed).

The only thing I'm having problems with is defining a newline in sed.

So getting everything on 1 line would help;
an expression for \n to be able to rearrange field / \(...\) \(...\)/ \2 \1/ would be ideal.

I'm only a beginner & I couldn't find a solution searching the forum.
Sponsored Links
    #2  
Old 12-10-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
 
Join Date: Mar 2007
Last Activity: 12 April 2014, 10:59 AM EDT
Location: Toronto, Canada
Posts: 2,875
Thanks: 0
Thanked 108 Times in 101 Posts
Quote:
Originally Posted by GDVS View Post
I'm writing a bash script that is supposed to turn a particular xml into xhtml. I'm using pipelines in between regular expressions (sed).

The only thing I'm having problems with is defining a newline in sed.

So getting everything on 1 line would help;
an expression for \n to be able to rearrange field / \(...\) \(...\)/ \2 \1/ would be ideal.

To remove all newlines from a file, use tr:


Code:
tr -d '\n' < FILE

(Remember to add a final newline.)
Sponsored Links
    #3  
Old 12-11-2008
GDVS GDVS is offline
Registered User
 
Join Date: Dec 2008
Last Activity: 11 December 2008, 9:44 AM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
thanks very much!!!
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Substitute in VI brian112 UNIX for Dummies Questions & Answers 3 02-14-2012 11:19 AM
substitute (') cosmologist UNIX for Dummies Questions & Answers 2 08-25-2011 02:31 AM
Calculate total space, total used space and total free space in filesystem names matching keyword bigben1220 Shell Programming and Scripting 4 11-25-2009 10:37 AM
How to substitute? vanitham Shell Programming and Scripting 2 12-14-2008 11:12 PM
Substitute in vi kingdbag UNIX for Dummies Questions & Answers 5 01-17-2007 01:42 PM



All times are GMT -4. The time now is 06:47 AM.