[ale] sed question
Matty
matty91 at bellsouth.net
Wed Nov 6 20:41:00 EST 2002
Hmmm...how about:
cat file.txt | while read line
do
echo "$line"
done
On Wed, 2002-11-06 at 19:52, David S. Jackson wrote:
> 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.
--
Ryan Matteson - UNIX Administrator
GPG ID: 7F89FE25 Ryan Matteson (Matty-GPG-2002) <matty91 at bellsouth.net>
Digitally Signed Public Key: http://www.daemons.net/~matty/public.txt
Fingerprint = 71D1 BA91 0F75 E79B BEFA EC23 A02E D4C9 7F89 FE25
This is a digitally signed message part
More information about the Ale
mailing list