Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

substitute \n by space

Shell Programming and Scripting


Tags
bash, newline reg-ex, sed newline

Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 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 Unix and Linux 12-10-2008
cfajohnson's Unix or Linux Image
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
 
Join Date: Mar 2007
Last Activity: 27 July 2015, 12:41 PM EDT
Location: Toronto, Canada
Posts: 2,896
Thanks: 0
Thanked 131 Times in 116 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 Unix and Linux 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 05:27 PM.