[Techtalk] ed < file

Dan Richter daniel.richter at wimba.com
Wed Nov 13 10:40:27 EST 2002


>The above command has the effect of passing lots of different arguments
>to ed, no passing it stuff on stdin.
<snip>
>What you want to do is:
>
>(cat <<EOF; ) | ed filename
>1,$s/foo/bar/g
>w
>q
>EOF

I don't get this. Isn't "cat" reading from stdin in this example? "cat" 
with a command-line argument refers to a file. So why is it stdin for "cat" 
and not for "ed"?

By the way, when I execute your command, I get:
   [dan at scandium dan]$ (cat <<EOF;) | ed index.php
   > 1,$s/foo/bar/g
   > w
   > q
   > EOF
   8090
   ?
   8090
So it looks like it understands the "w" command (hence the second 8090), 
but not the substitution command. But that's progress relative to where I was.

========== Dan Richter ============== mailto:Dan at wimba.com ===========
      Fines (as of 1998) for smoking against local ordinances:
               Singapore:   10,000 sing. $   = US$ 600.00
               Turkey:      10,000,000 liras = US$  32.00
               China:       10 yuan          = US$   1.00




More information about the Techtalk mailing list