[Techtalk] ed < file

Malcolm Tredinnick malcolm at commsecure.com.au
Wed Nov 13 22:56:06 EST 2002


On Wed, Nov 13, 2002 at 11:53:16AM +0100, Dan Richter wrote:
> Now I'm really confused. Standard "ed" commands work when piping from a 
> file:
>   ed filename < commands.txt
> but not like this:
>   (cat <<EOF;) | ed filename
>   > 1,$s/foo/bar/g
>   > w
>   > q
>   > EOF

Aah .. light dawns.... shell quoting rules apply!

You need to write the substitution line as 1,\$s/foo/bar/g (tested this
time, too). Otherwise the shell tries to put in the value of the $s
variable.

Malcolm
-- 
Honk if you love peace and quiet.



More information about the Techtalk mailing list