- 论坛徽章:
- 6
|
回复 2# csccyab
# [ /home/soio/1bs/awks ] {2018-03-18 13:22:22} : 1521350542:0;
# ༺ ༻ # ➜ awk 'NR==FNR{a[$1]=$0; next} { if ($1 in a){b[$1]=$0}} END {for (i in a){ print a"\n"b }}' <(cat -n f1.xy) f3.xy ## ole
299 # delete duplicate, nonconsecutive lines from a file. Beware not to
299 #删除复制,从一个文件中不连续的线。注意不要
300
301 # overflow the buffer size of the hold space, or else use GNU sed.
301 #溢出保留空间的缓冲器的大小,否则使用GNU sed。
302 -> sed -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P'
303 -> awk '!a[$0]++'
304
305 # delete all lines except duplicate lines (emulates "uniq -d").
305 #删除重复行的所有行(模仿“ uniq -d”)。
306 -> sed '$!N; s/^\(.*\)\n\1$/\1/; t; D'
307 -> awk '!(a[$0]++-1)'
308
309 # delete the first 10 lines of a file
309 #删除一个F的前10行
##行啊!##########截取 299-309 的段落
|
|