linux grep

Commands I’ve used so far for grep

Find text string in file

grep -rlHrnIi "literal search string" folder
grep -rlHrnIi "/admin/" /home/tech/.PlayOnLinux

replace string one person successfully used:

grep -rl matchstring somedir/ | xargs sed -i 's|/string1|/string2|g'

but they say this is better

find /path/to/files -type f -exec sed -i 's|oldstring|new string|g' {} \;
find /home/tech/.PlayOnLinux -type f -exec sed -i 's|/admin/|/tech/|g' {} \;