[ale] sed question
David S. Jackson
deepbsd at earthlink.net
Wed Nov 6 19:52:06 EST 2002
How would I solve the following problem:
]$ for i in `cat sample.txt|sed -e 's/ /\ /g'; do
> echo $i
> done
where sample.txt is a simple text files with words and sentences
and spaces between the words. If I substitute an underscore
]$ for i in `cat sample.txt|sed -e 's/ /_/g'`; do
> echo $i
> done
then the text comes out as I want it, except that there's an
underscore where I want a space. However, when I try to add an
escaped space so the shell will leave it alone, the escaped space
never makes it to the echo statement (I guess), and I wind up
with one single word per line.
What's the way around this problem?
TIA!
--
David S. Jackson dsj at dsj.net
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
A black cat crossing your path signifies that the
animal is going somewhere.
-- Groucho Marx
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list