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

From: kevin lyda (kevin at domain suberic.net)
Date: Mon 23 Aug 1999 - 12:52:41 IST


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

kevin



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