cut
echo $PATH | cut -d ':' -f 3,5
- -d Use colon instaed TAB as a field delimiter ,and
- -f Select 3 to 5 fields of the line data .also print line data with no delimiter charater,unless the -s option is specified
grep
grep [-cinv] 'target string' filename
cat file1 | grep [-cinv] 'target string'
- -c print the count of matching line in the input file
- -i serach the target string ingoring case distinction
- -n print result line number
- -v Invert the sense of matching .print line data with no target string
sort
cat file1 | sort [-frutk]
- -f ingore case distinction
- -r revert the order
- -u list only one line if line data same with each other
- -t use specified delimeter charater instead of TAB
- -k order by specified field
uniq
cat file1 | uniq [-ic]
only print unique lines ,report or omit repeated lines
- -i igonre case distinction
- -c print line count
wc
cat file1 | wc
-
-c, --bytes
print the byte counts -
-m, --chars
print the character counts -
-l, --lines
print the newline counts