Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sed question 1

Status
Not open for further replies.

zaxxon

MIS
Dec 12, 2001
226
DE
Hi,

I found following lines in the "sed 100 oneliners":

# if a line ends with a backslash, append the next line to it
sed -e :a -e '/\\$/N; s/\\\n//; ta'

I understand what happens there but I don't understand, why it is done with a loop :)a, ta). It works without too. Can anybody give me a hint, for what case it is good for, please?

Thanks in forward.

laters
zaxxon
 
Hi

Code:
[blue]master #[/blue] echo 'one
> two[red]\[/red]
> two and half[red]\[/red]
> two and three quarters
> three
> ' | sed -e :a -e '/\\$/N; s/\\\n//; ta'
one
twotwo and halftwo and three quarters
three

[blue]master #[/blue] echo 'one
two[red]\[/red]
two and half[red]\[/red]
two and three quarters
three
' | sed -e '/\\$/N; s/\\\n//'
one
twotwo and half[red][u]\[/u][/red]
two and three quarters
three

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top