Relative Content

Tag Archive for sed

Replace the fasta headers with sed

I have a fasta file with multiple headers:
`>contig00001_len=155988_cov=17.1_corr=0_origname=NODE_1_length_155988_cov_17.103139_sw=shovill-spades/1.1.0_date=20240120
AATTCTAACAGGTCAGATATTTCTACAATAGCATCGCGAATACCACCAATATA

Bash shell script to replace 3rd word/string to zero if it contains empty

Bash Shell script to replace the third value to zero if it has no value or empty.
values are closed by #^#^, seprated by pipe and records are terminated with new line
My file have so many lines ,so if any record/line of 3rd string/value contains empty or null needs
to be replaced by zero 0.
#^11abc27#^|#^x26729#^|#^#^|#^82.41#^|#^173#^|#^yx Corportaion#^
want change to
#^11abc27#^|#^x26729#^|#^0#^|#^82.41#^|#^173#^|#^yx Corportaion#^