This description will be used for the article listing and search results on Google.
2023-05-20
cut f 1,2 foo.txt > bar.txt
paste foo.txt bar.txt > output.txt
////////foo.txt////////
1 2
1 2
1 2
///////bar.txt////////
3 4 5
3 4 5
3 4 5
///////output.txt///////
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
sed 's/unix/linux/g' obj.txt
sed 's/unix/linux/2' obj.txt
sed 's/unix/linux/2g' obj.txt
sed 's/^/HEAD/g' obj.txt
sed 's/$/TAIL/g' obj.txt
s
--替换 | unix
为内容关键字 | linux
为替换内容 | g
为 global,替换每行中所有匹配的关键字 | 2
每行只替换第二个匹配的 | 2g
每行替换第二个及第二个以后的 | ^``$
分别为每行开头标志和结尾标志awk '{$2 = ""; print $0}' obj.txt