On Thu, Sep 13, 2001 at 04:55:53PM -0400, Douglas J. Hunley wrote:
>I'm trying to write a script to remove parts of a file and am having
>difficulty. The code looks like:
>#!/bin/sh
>
>for i in zh fr de it ja ko pt es
>do
> for j in `find . -newer .babel -name '*.html' -print`
> do
> cat $j.$i | sed
>'s/http\:\/\/babelfish\.altavista\.com\/urltrurl?lp=en_$i\&url=//g' >>
>$j.$i.tmp
> mv $j.$i.tmp $j.$i
> done
>done
>
>you can see that within the 'sed' I want to use $i... I can't figure out a
>way to do this. Anyone?
You need to use double quotes around the variables you need to
expand. Something like this:
sed 's/xxx'"$i"'/yyy'"$j"'/'
Be very careful matching the single quotes (perl is a lot easier
for this type of thing).
Bill
--
INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC
UUCP: camco!bill PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/
DOS: n., A small annoying boot virus that causes random spontaneous system
crashes, usually just before saving a massive project. Easily cured by
UNIX. See also MS-DOS, IBM-DOS, DR-DOS.
_______________________________________________
http://linux.nf -- [EMAIL PROTECTED]
Archives, Subscribe, Unsubscribe, Digest, Etc
->http://linux.nf/mailman/listinfo/linux-users