|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I'd like to open a file called text.txt, to search for "value", and to
change this string to a short paragraph. Here's what I tried but it didn't work: sed 's/value/firstline \r secondline \r thirdline/g' text.txt > tempfile && mv -- tempfile text.txt The "\r" appears as " r " instead of creating carriage returns. Any idea? Thanks in advance, |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
2006-12-6, 13:26(-08), Charles A. Landemaine:
> I'd like to open a file called text.txt, to search for "value", and to > change this string to a short paragraph. Here's what I tried but it > didn't work: > > sed 's/value/firstline \r secondline \r thirdline/g' text.txt > > tempfile && mv -- tempfile text.txt > > The "\r" appears as " r " instead of creating carriage returns. Any > idea? [...] Note that carriable return is not the line separator on Unix. On Unix, it's linefeed also known as newline, ^J, LF, NL, \n, 0x0a, \012. sed 's/value/firstline\ secondline\ thirdline/g' text.txt -- Stéphane |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Stephane CHAZELAS wrote: > Note that carriable return is not the line separator on Unix. On > Unix, it's linefeed also known as newline, ^J, LF, NL, \n, 0x0a, > \012. > > sed 's/value/firstline\ > secondline\ > thirdline/g' text.txt Thanks, Stéphane, this did the trick! ![]() Charles. |
|
![]() |
| Outils de la discussion | |
|
|