Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I have 70mb .tsv file, i want to remove the '/' from each line and add space instead of '/' using sed or tr or any linux based command

I want to remove the ‘/’ from each line and add space instead of ‘/’

Example input:

7 47562385 47562385 ctttttttttttttttt/cttttttttttttttt

11 48932150 48932150 C/A

6 87733066 87733066 caaaaaaaaaaaaaaaaaaaaaa/cAAaaaaaaaaaaaaaaaaaaaaaa

8 4056078 4056078 cttttttttttttttttttttt/cTTttttttttttttttttttttt

I want the out put like this

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

7 47562385 47562385 ctttttttttttttttt cttttttttttttttt

1 48932150 48932150 C A

6 87733066 87733066 caaaaaaaaaaaaaaaaaaaaaa cAAaaaaaaaaaaaaaaaaaaaaaa

8 4056078 4056078 cttttttttttttttttttttt cTTttttttttttttttttttttt

>Solution :

You can use a combination of grep and sed to replace all occurrences of / with a space in each line of your input file.

grep . input.txt | sed 's/\// /g

If you want to save the output to a new file, you can redirect the output:

grep . input.txt | sed 's/\// /g' > output.txt

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading