1.grep dot
$ grep . *.txt jack.txt:Once upon a time jack.txt:there was a fellow named Jack. lyingryan.txt:Now that "trickle down economics" has been lyingryan.txt:tested for 30 years and the data shows it lyingryan.txt:has been a total failure, candidates lyingryan.txt:still claim that cutting taxes for lyingryan.txt:billionaires will help the economy. market.txt:Jack went to market to sell the family market.txt:cow. market.txt:He came back with a handful of magic beans. $
2.more star pipe cat
more * | cat :::::::::::::: jack.txt :::::::::::::: Once upon a time there was a fellow named Jack.
:::::::::::::: lyingryan.txt :::::::::::::: Now that "trickle down economics" has been tested for 30 years and the data shows it has been a total failure, candidates still claim that cutting taxes for billionaires will help the economy. :::::::::::::: market.txt ::::::::::::::: Jack went to the free-market to sell the family cow.
He came back with a handful of magic beans. $
也可以使用head -n 1000 *|cat
3.grep --color=always '^|foo|bar' 等价于grep --color=always '|foo|bar'
$ gnt-job list | egrep --color=always '^|running|waiting' 157486 success CLUSTER_VERIFY_CONFIG 157487 success CLUSTER_VERIFY_GROUP(7ee44802-85d3-40fb-bd36-a7e701ecea29) 157488 success CLUSTER_VERIFY_GROUP(72a2138c-dc07-494d-bd02-ebff7916c9bc) 157489 success CLUSTER_VERIFY_GROUP(457c7377-c83b-4fed-9ebe-a2974e2c521f) 157712 success OS_DIAGNOSE 157779 success CLUSTER_VERIFY 157780 success CLUSTER_VERIFY_CONFIG 157781 success CLUSTER_VERIFY_GROUP(7ee44802-85d3-40fb-bd36-a7e701ecea29) 157782 success CLUSTER_VERIFY_GROUP(72a2138c-dc07-494d-bd02-ebff7916c9bc) 157783 success CLUSTER_VERIFY_GROUP(457c7377-c83b-4fed-9ebe-a2974e2c521f) 157994 success OS_DIAGNOSE 158073 running CLUSTER_VERIFY 158074 success CLUSTER_VERIFY_CONFIG 158075 success CLUSTER_VERIFY_GROUP(7ee44802-85d3-40fb-bd36-a7e701ecea29) 158076 success CLUSTER_VERIFY_GROUP(72a2138c-dc07-494d-bd02-ebff7916c9bc) 158077 success CLUSTER_VERIFY_GROUP(457c7377-c83b-4fed-9ebe-a2974e2c521f) 158156 success OS_DIAGNOSE 158367 success CLUSTER_VERIFY 158368 waiting CLUSTER_VERIFY_CONFIG 158371 success CLUSTER_VERIFY_GROUP(457c7377-c83b-4fed-9ebe-a2974e2c521f) 158432 waiting OS_DIAGNOSE $4. "fmt -1" (split lines into individual words)
$ cat *.wiki | fmt -1 | egrep -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort -u 192.168.1.4 192.168.1.7 255.255.255.0# 255.255.255.192 255.255.255.240 8.3.8.1 <code>172.16.240.1 <code>172.16.240.2
$ cat *.wiki | tr "#:@;()<>=,'-\"" ' ' | fmt -1 | egrep -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tr -d ' ' | sort -u 172.16.240.1 172.16.240.2 192.168.1.4 192.168.1.7 255.255.255.0 255.255.255.192 255.255.255.240 8.3.8.1