2
[sed] Replace String in Directory
source link: http://siongui.github.io/2017/01/11/sed-replace-string-in-directory/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
[sed] Replace String in Directory
January 11, 2017
Question:
Replace strings of the pattern gettext('Archives', DEFAULT_LANG) with 'Archives'|gettext(DEFAULT_LANG) in HTML files under template/ directory.
Answer(inspired by [2], [4], and [5]):
$ cd template/ $ find -type f -name '*.html' | xargs sed -i "s/gettext('\(.*\)', /'\1'|gettext(/g"
References:
Author: Siong-Ui Te ∈ Category: Bash
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK