[Prev][Next][Index][Thread]

Re: a sed question...



On Mon, 17 Feb 1997, Ira Abramov (at work) wrote:

> 
> moving an entire tree of a website from .html to .htm, using foreach, I am
> trying to inject each file through such a commandline:
> 
> cat 129.html | sed -e 'sg/.html/.htm/' > 129.htm
> 
> i.e. changing the filename and the links inside at the same time.
> 
> anyone has an idea why I get "sed: Unexpected End-of-file" on this? all
> the *.htm files are just opened and not even the first line is written...
> all are 0 bytes long.

Because Unix is a multitasking OS, the shell opens the file for 
redirection while sed is running and truncates it just like it should. (> 
truncates if NO_CLOBBER or whatever isn't set), I know there's a command 
line option for sed to change files, but it's not reccomended or 
something. Might I suggest using perl and not a command line with 
redirections?


Regards,
Nir.


--
Nir Soffer AKA ScorpioS. scorpios@cs.huji.ac.il
"Power corrupts.  Absolute power is kind of neat"
                -- John Lehman, Secretary of the Navy 1981-1987



Follow-Ups: References: