一个文件中有两列,linux上用脚本怎么实现第一列相同的情况下把第二列用&符链接起来

一个文件中有两列,linux上用脚本怎么实现第一列相同的情况下把第二列用&符链接起来,第1张

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文件

root_path=os.path.abspath(os.path.abspath(os.path.dirname(__file__)).split("flash")[0]+"/flash/app//")

configpath=os.path.join(root_path,"Kit/my_public_funds/conf/conf.ini")


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/7197860.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-02
下一篇 2023-04-02

发表评论

登录后才能评论

评论列表(0条)

保存