< div> 6 7
div>
Detailed supplementary explanation based on https://www.cnblogs.com/wangyuebo/p/5836933.html
< div> 4 5
< div> 9
< div> 2 2
div>
< div> 3 7
[ [emailprotected] awk]# seq 10|xargs -n 2> file
[ [emailprotected] awk]# seq 10-1 1|xargs -n 2> file1
xrags -n 2 [means that the number of each batch is 2, and the default interval is “”]
seq 10 -1 1 [means generating 10 numbers, output in reverse order, step size is 1]
[ [email protected] awk]# cat file1
2 3
4 5
6 7
8 9
1 0
< p>
[ [email protected] awk]# cat file |awk'{print $1}’
1
3
5
7
9
[ [email protected] awk]# awk'{print NR}’ file file1
1< /p>
2
3
4
5
6
7
8
9
10
[ [email protected] awk]# awk'{print NR,FNR}’ file file1
1 1
2 2
3 3
4 4
5 5
6 1
7 2
8 3
9 4
10 5
[ [emailprotected] awk ]#
[ [email protected] awk]# awk’NR==FNR{a[NR]=$1}NR!=FNR{print a[FNR],$2 }’file file1
1 93 75 57 39 1
[ [email protected] awk]#
Detailed explanation of awk:
Awk is a line processor: Compared with the advantages of screen processing, there will be no memory overflow or slow processing problems when processing large files. It is usually used for formatting Text information
Awk processing process: Process each line in turn, and then output
Special points:
$0 represents the entire current line
< p>$1 The first field in each line
NF The number of fields variable
NR The record number of each line, the number of records in each line, the number of records in multiple files increases
FNR Similar to NR, However, multi-file records do not increment, and each file starts from 1
Tab character
Line break
FS Define separator when BEGIN
RS The entered record separator, the default is a newline character (that is, the text is entered line by line)
~ Match, it is not an exact comparison with ==
< p>~ Mismatch, inaccurate comparison
== Equal, must all be equal, exact comparison
Not equal, exact comparison
&& Logic And
|| Logical OR
+ When matched, it means one or more than one
/[0-9][0-9]+/ Two One or more numbers
/[0-9][0-9]*/ One or more numbers
FILENAME file name
OFS output The field separator, which is also a space by default, can be changed to a tab character, etc.
The record separator output by ORS, the default is a newline character, that is, the processing result is also output to the screen line by line
-F'[:#/]’ Define three separators
[ [email protected] awk]# paste file3 file4
1 9
p>
3 7
5 5
7 3
9 1
[ [emailprotected] awk]# paste file3 file4|tr ” ” “”
1 9
3 7
5 5
7 3
9 1
The paste command will merge each file line by line, line by line.
-d
-s or –serial serialize instead of parallel processing.
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 518 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC