Word count
[root]# wc readme.txt
[root]# wc -l readme.txt --> number of lines
[root]# wc -w readme.txt --> number of words
Command substitution
[root]# rm `cat garbage-files.list.txt`
Combining commands
[root]# cp file1 file2; rm file3
[root]# grep Austin cities.txt && vi cities.txt
----------
|_ executes vi if grep succeeds
[root]# grep Florida states.txt || grep Missisipi states.txt
[root]# grep -E '^abc$ ^def$'
[root]# grep -F -x 'abc def'
[root]# find joomla/ -type f -print0 | xargs -0 grep "font"
[root]# dmesg | grep ^Blue*
[root]# ifconfig -a | more
[root]# grep -c '^processor' /proc/cpuinfo
[root]# grep -i 'orange' /proc/cpuinfo ---------------------> ignore case
[root]# grep -B 0 -A 1 --color '^bind' /etc/redis.conf ------> show lines before and after
Grep only uncommented line of configuration
[root@thermalite ~]# cat /var/lib/pgsql/data/postgresql.conf | awk '{$1=$1;print}' | grep -v "^#" | awk 'NF'
Tuesday, December 23, 2008
Manipulating text files
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment