Re: [ILUG] Find & replace script (?)

From: Lars Hecking (lhecking at domain nmrc.ucc.ie)
Date: Mon 23 Aug 1999 - 12:57:39 IST


kevin lyda writes:
> Lars Hecking spoke thusly:
> >$ for i in `find /foo/bar -name '*.html' -print` ; do mv ${i} ${i}.bak ; \
> > sed 's,tag,replacement,g' ${i}.bak >${i} ; rm -f ${i}.bak ; done
> >
> > If the tag is different in different files, it gets more complicated,
> > and others might suggest perl ...
>
> i think sed's the way to go and sent an email privately with much the
> same suggestion. one point though is the 10,000 to 35,000 files.
> won't the find command blow away the command line limit length?
> i split it up - find > file.list; cat file.list | xargs -n 1 script

 Generally, I agree, but I think that GNU find and bash should
 cope quite well. Assuming the system in question is running Linux :)



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:29 GMT