
{
tmpfile=$(mktemp $(dirname "$1")/XXXXXX)
mv "$1" "$tmpfile" && mv "$2" "$1" && mv "$tmpfile" "$2"
}
吧代码加到~/.bashrc中,然后输入swap A B即可
sort -k 1,1 filea|awk 'BEGIN { first=1}
{if ($1==LAST)
{
result=result&$2
first=0
}
else if
{
if (first==0)
{
print result
result=$0
first=1
}
first=0
}
}
END { print result}' > fileb
将filea中第二列拼接,输出至fileb文件中
1、首先,连接相应linux主机,进入到linux命令行状态下,等待输入shell指令。
2、其次,在命令行中输入:cat test.txt test1.txt >test2.txt。
3、键盘按“回车键”运行shell指令,此时会看到2个文件成功合并到test2.txt了。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)