[[email protected] awk]# seq 10|xargs -n 2 > file [[email protected] awk]# seq 10 -1 1|xargs -n 2 > file1 [[email protected] awk]# cat file 1 2 3 4 5 6 7 8 9 10 [[email protected] awk]# cat file1 10 9 8 7 6 5 4 3 2 1 [[email protected] awk]# cat file |awk ‘{print $1}‘ 1 3 5 7 9 [[email protected] awk]# cat file1 |awk ‘{print $2}‘ 9 7 5 3 1 [[email protected] awk]# cat file |awk ‘{print $1}‘>file3 [[email protected]st awk]# cat file1 |awk ‘{print $2}‘>file4 [[email protected] awk]# paste file3 file4 1 9 3 7 5 5 7 3 9 1 [[email protected] awk]# paste file3 file4|tr "\t" " " 1 9 3 7 5 5 7 3 9 1 [[email protected] awk]# paste file3 file4|tr "\t" " ">file5 [[email protected] awk]# cat file5 1 9 3 7 5 5 7 3 9 1 [[email protected] awk]# awk ‘1‘ file 1 2 3 4 5 6 7 8 9 10 [[email protected] awk]# awk ‘1‘ file1 10 9 8 7 6 5 4 3 2 1 [[email protected] awk]# awk ‘1‘ file1 file1 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 [[email protected] awk]# awk ‘{print NR}‘ file file1 1 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 [[email protected] awk]# [[email protected] awk]# awk ‘NR==FNR{a[NR]=$1}NR!=FNR{print a[FNR],$2}‘ file file1 1 9 3 7 5 5 7 3 9 1 [[email protected] awk]#
时间: 2024-11-10 08:29:43