Replace 111 with 222 in the file file.txt
grep '111' -P -R -I -l file.txt | xargs sed -i 's/111/222/g'
Blog
Find and Replace Text in a File
Replace 111 with 222 in the file file.txt grep '111' -P -R -I -l file.txt | xargs sed -i 's/111/222/g'

Replace 111 with 222 in the file file.txt
grep '111' -P -R -I -l file.txt | xargs sed -i 's/111/222/g'
Note: This post may be AI-assisted and then human-edited. Editorial responsibility: Dmytro Lomaka, Kaltenkirchen.
Essential cookies are always active. Statistics, external fonts and marketing load only with your consent (GDPR).
Language, session, consent storage
Anonymous visit analytics
Google Fonts and other CDNs
Advertising pixels and trackers
Scan to open this site quickly on your phone