1. xargs
Xargs
More practical applications $
Ls | xargs-t-I MV {}{}. Bak
-The I option tells xargs to replace {} with the name of each item {}.
Parameter Parsing:
T ----------------- print out the command before executing
I ------------------ Replace with the file name {}
Delete a large number of files
Ls | xargs-N 20 Rm-fr
Parameter Parsing:
N ----------------------- N number indicates how many ls outputs are taken as a group and used as the parameters of the subsequent commands.
Ls is of course the output of all file names (separated by spaces)
Xargs refers to the output of LS, every 20 are a group (with space as the separator), as the RM-RF parameter, that is, 20 are all file names, deleted by RM-RF, this will not exceed the length of the command line.
2. awk
Purpose
Finds lines in files that match a pattern and performs specified
Actions on those lines.
Translate to Chinese:
Purpose:
Find a row that matches a format in the file and perform the specified operation on the row.
Syntax:
Awk [-u] [-F ere] [-V Assignment]... {-F programfile |
'Signature'} [[file... | assignment...]...
-F option to specify the field separator
Example:
Awk-F ":" '{print "username:" $1 "uid:" $3}'/etc/passwd
Specify: As the field separator of the file
X = 'df-k a file system | awk-f''' {print $4} '| grep-V used | SED's/% //''
Ignore syntax
3. Sed