1.文件内容提取
- 去掉表头,取第一列,存入新文件
tail -n +2 sig-genes-deseq2.txt | awk '{print $1}' > sig-genes-list.txt
- 取第一行,将制表符换成换行符
head -n1 111.txt | tr '\t' '\n\'
-
echo "aaa" | xargs -I {} echo {}
-I参数指定替换字符窜 大括号
- 删除前三行
sed -i.bak '1,3d’ sed.ttt
2.批量操作
-
for fn in data/DRR0161{25..40};
dosamp=`basename ${fn}`
echo "Processing sample ${samp}"
salmon quant -i athal_index -l A \
-1 ${fn}/${samp}_1.fastq.gz \
-2 ${fn}/${samp}_2.fastq.gz \
-p 8 -o quants/${samp}_quant
done
-
for ((i=1;i<=19;i++))
for i in `seq 25 40`
for name in *.fastq; do echo $name; done
for id in {14..19}
-
do
mkdir DRR0161${i};
cd DRR0161${i};
wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/DRR016/DRR0161${i}/DRR0161${i}_1.fastq.gz;
wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/DRR016/DRR0161${i}/DRR0161${i}_2.fastq.gz;
cd ..;
done
3.文件操作
- 搜索文件
find / -name httpd.conf
- 查看
ls -alth
- 查看目录大小
du -sh
- 程序运行
echo 'java -jar ~/src/Trimmomatic-0.32/trimmomatic-0.32.jar $@' >> ~/bin/trimmomatic
chmod +x ~/bin/trimmomatic
- 除去不匹配的文件
ls | grep -v gz
- 显示目前后台tophat进程,并kill
ps aux | grep tophat | awk ‘{print $2}’ | xargs kill -9
screen -r tmp_tophat_x_ten
try
- 删除文件第一行:
sed -i '1d' filename
- 删除文件最后一列:
awk '{print $NF}' filename
- 比较文件的方法:
1)comm -3 --nocheck-order file1 file2
-
grep -v -f file1 file2
: 输出file2中有file1中没有的行
diff file1 file2