- Show both file and matched string:
- grep -R text /home/users/workspace
- grep -lir text /home/users/workspace
- Show only file: grep -Rl text /home/users/workspace
- Grep and append string: more musiclist.txt | grep ecx | sed -e 's/^/wget /'
- Append a string on the every line from the grep result.
- ls -a | grep "Vol_" | perl -ne 'print "zip $_"'
- ls -a | grep "rar" | perl -ne 'print "unrar x $_"'
- Grep than replace string:
- grep -rl matchstring somedir/ | xargs sed -i 's/string1/string2/g'
- grep -rl 'windows' ./ | xargs sed -i 's/windows/linux/g'
2015年8月24日 星期一
grep commands
Search within a directory:
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言