I was wondering if this is possible in find command. I am trying to find all the specific files with the following extensions then it will be SED after. Here's my current command script:
find . -regex '.*\.(sh|ini|conf|vhost|xml|php)$' | xargs sed -i -e 's/%%MEFIRST%%/mefirst/g'
unfortunately, I'm not that familiar in regex but something like this is what I need.
man find
that your version of find has the-regex
option? Not all do. Are you saying it doesn't work. Looks OK to me, but I my systems doesn't havefind . -regex
, so I can't say for sure. Good luck. – shellter Mar 25 '14 at 3:30find . -regex ".*\.\(sh\|ini\|conf\|vhost\|xml\|php\)" -print | xargs sed -i -e 's/%%MEFIRST%%/mefirst/g'
These script will select all the files with the following extensions: sh, ini, conf, vhost, xml, php and will replace the text %%MEFIRST%% to mefirst inside the files selected. – user3282191 Mar 25 '14 at 3:33