search/replace carriage return in sed

search/replace carriage return in sed

Post by blah.. » Tue, 21 Nov 2000 04:00:00



i'm converting an html file into straight text and reformatting it at
the same time. i have everything done but my carriage return problem. i
need a way to search for </n>carriage return and change into two spaces.
something like this:
sed 's/<\/n>\n/  /g'
which i know doesn't work but should give you a better idea of what i
need. thanks in advance,
blah

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

search/replace carriage return in sed

Post by bmar.. » Tue, 21 Nov 2000 04:00:00



   >i'm converting an html file into straight text and reformatting it
   >at the same time. i have everything done but my carriage return
   >problem. i need a way to search for </n>carriage return and change
   >into two spaces. something like this:
   >sed 's/<\/n>\n/  /g'
   >which i know doesn't work but should give you a better idea of what
   >i need. thanks in advance,
awk '/<\/n>$/{printf "%s  ",$0;next} {print}'

Net-Tamer V 1.08X - Test Drive

 
 
 

1. sed - search, then search & replace on the result?

I'm using a bash script to parse various java source files, and need a
way to do a search and replace on certain lines (that need to match
certain criteria themselves) - a search, then a search and replace on
the results of the first search, if you will.

For example, working on a public method declaration, the parameters
(and related types) need to be on seperate lines:

public void doSomething(int x, int y, boolean maybe)

becomes:

int x
int y
boolean maybe

Currently, I'm working with sed, but 'standard' unix tools (excepting
perl, if at all possible) are available.

Any help would be greatly appreciated... thanks! :)

2. SAIR Linux & GNU Exam Questions

3. want to replace ',' by carriage return

4. LILO config on ide zip?

5. Replacing line feed with carriage return

6. Help for a Newbie, thnx

7. Using 'tr' to replace Carriage Return & Line Feed.

8. Your favorite newsreader?

9. replacing "," with a carriage return

10. recursively replace carriage returns

11. carriage return representation with sed

12. Problem: Command substitution adds an extra carriage return character on return.

13. vi search and replace windows cariage return