R常用指令

在一次项目中用到R指令:

计算z1.txt文件行数: awk '{print NR}' z1.txt | tail -n1     

向z16文件中添加一列   name:     sed -i '1 i\name' z16.txt  
向z14.txt文件中增加bead_threshold_nosafety bead_threshold jaccard_threshold_nosafety jaccard_threshold等列数据

                sed -i '1 i\   bead_threshold_nosafety bead_threshold jaccard_threshold_nosafety jaccard_threshold '      z14.txt

将z16 与Z14合并到z1文件夹中  paste z16.txt z14.txt >z1.txt   (z16在左,z14在右)

在文件集中找出带有bapParams.csv的文件,并统计有bead_threshold_nosafety的数据,将其打印到z1.txt文件中。
                            for i in *.bapParams.csv;        do grep "bead_threshold_nosafety"            $i >> z1.txt;done  

 统计行数             grep -c "" Abdominal_fat_20200520_AJ1_web_0_backup.barcodeQuantSimple.csv  

 删除一行数据      sed -i '1d' z21.txt  

 打印全部数据      less -S z15.txt(以适应屏幕的形式打印出来,和cat 打印方式不同) 


 删除z13.txt特定字符jaccard_threshold_nosafety  ,并将结果整合到z14.txt中:

                                 sed -e's/jaccard_threshold_nosafety  ,/''/g' z13.txt>z14.txt  

扫描二维码关注公众号,回复: 13003499 查看本文章

                                sed -e 's/_web_4_backup.bapParams.csv/' '/g' z7.txt>z8.txt

touch ball 创建新文件ball

猜你喜欢

转载自blog.csdn.net/weixin_41792162/article/details/108318080
今日推荐