1. Field (column) Extraction command: Cut [option] file name
Options:-F column number (extract the first few columns)-D delimiter (split column by specified delimiter)
[email protected] sh]# cat student.txt idnamegendermark1alex male 112boby male 223cyan male 334daugemale 44[[email Protected] sh]# cut-f 2 student.txt #-F Set column number Namealexbobycyandauge[[email protected] sh]# cut-f 2,4 student.txt Nam Emarkalex 11boby 22cyan 33dauge44[[email protected] sh]# grep "/bin/bash"/etc/passwd | Grep-v "Root" #-V to take anti-user1:x:502:502::/home/user1:/bin/bashuser2:x:503:503::/home/user2:/bin/bash[[email Protected] sh]# grep "/bin/bash"/etc/passwd | Grep-v "Root" | Cut-f 1-d ":" #-D set delimiter
2. Format output command: PRITF ' output type output format ' output content
[email protected] sh]# cat Student.txt Idnamegendermark1alexmale112bobymale223cyanmale334daugemale44[[email Protected] sh]# printf '%s\t%s\t%s\t%s\n ' $ (cat student.txt) Idnamegendermark1alexmale112bobymale223cyanmale334daugemale44
3. The awk command
4. SED command
Shell programming Character intercept commands