The usage of sed

The usage of sed

1

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?


linux


sed


shell

• 51 views

updated 1 hour ago by

16k

written 2 hours ago by

0

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' 


Login
before adding your answer.

Source link