On Sun, Mar 14, 2004 at 04:30:40PM -0600, Steven N. Fettig wrote:
Sorry for posting an off-topic question to the list, but this is
somethin that has been driving me nuts for weeks now and I can't figure
it out. I want to pass a text file through sed that replaces all
whitespaces with a
in message [EMAIL PROTECTED],
wrote Warren Block thusly...
...sed on other systems does handle \n and other literals in
substitutions. It's annoying enough that I just use Perl instead.
perl -pe 's/ /\n/g' my_test_text_document.txt
which actually would be better as
perl -pe
On Mon, 15 Mar 2004, Parv wrote:
in message [EMAIL PROTECTED],
wrote Warren Block thusly...
perl -pe 's/\s./\n/g' my_test_text_document.txt
^
^
Why do you have '.' after '\s'? Did you mean '+' instead?
Oops--you're correct. \s+ for one or more
Sorry for posting an off-topic question to the list, but this is
somethin that has been driving me nuts for weeks now and I can't figure
it out. I want to pass a text file through sed that replaces all
whitespaces with a carriage return. I.e., if I have the file
my_test_text_document.txt
On Sun, Mar 14, 2004 at 04:30:40PM -0600, Steven N. Fettig wrote:
Sorry for posting an off-topic question to the list, but this is
somethin that has been driving me nuts for weeks now and I can't figure
it out. I want to pass a text file through sed that replaces all
whitespaces with a
On Sun, 14 Mar 2004, Steven N. Fettig wrote:
I can't figure out what the newline character is... I've tried \n \r \,
etc. with no avail. I run the following:
sed 's/[ ]/\n/g' my_test_text_document.txt
From the sed man page:
2. The escape sequence \n matches a newline character embedded
On Sun, Mar 14, 2004, Warren Block wrote:
On Sun, 14 Mar 2004, Steven N. Fettig wrote:
I can't figure out what the newline character is... I've tried \n \r \,
etc. with no avail. I run the following:
sed 's/[ ]/\n/g' my_test_text_document.txt
From the sed man page:
2. The escape sequence
On Sun, 14 Mar 2004, Rob Ellis wrote:
This works with sed in /bin/sh and ksh:
sed -e 's/ */\
/g' my_test_text_document.txt
I.e., escape an actual newline.
I used to do that, or include an actual newline in a script, but it just
seems wrong from maintainability and readability standpoints.