The usage of sed
sed -e 's/_scATAC_hg19_noDup_noMT.bam//g' -e 's//directory/to/singleCell///g' bamlist.txt | sed -e 's///t/g' | awk 'OFS="t"{print $2}' | tr 'n' 't' > header.txt
This replacement command is too complex. Can someone explain what this means?
• 51 views
sed -e 's/_scATAC_hg19_noDup_noMT.bam//g' -e 's//directory/to/singleCell///g' bamlist.txt |
sed -e 's///t/g' |
awk 'OFS="t"{print $2}' |
tr 'n' 't' > header.txt
replace all instances of “_scATAC_hg19_noDup_noMT.bam” with empty string
replace all instances of “/directory/to/singleCell/” with empty string
replace all instances of “https://www.biostars.org/” with a tabulation
print the 2nd column
convert all instances of <carriage-return> with a tabulation
which I would write as
sed 's%_scATAC_hg19_noDup_noMT.bam%%g;s%/directory/to/singleCell/%%g' | tr "https://www.biostars.org/" "n" | cut -f 2 | tr 'n' 't'