Navigation

Find And Replace Text in Multiple File in Linux Console

find . -name '*.txt' | xargs perl -pi -e 's/oldtext/newtext/g'

examples:

find . -name '*.txt' | xargs perl -pi -e 's/From: root/From: csf\@donie\-centos5\.slowrock\.com/g'
find . -name '*.txt' | xargs perl -pi -e 's/To: root/To: donie\@slowrock\.com/g'

Reply
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <h1> <h2> <h3> <h4> <h5> <h6> <em> <strong> <code> <del> <blockquote> <q> <cite> <sup> <sub> <p> <br> <ul> <ol> <li> <dl> <dt> <dd> <a> <b> <u> <i>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].

More information about formatting options