remove backslash at every line

user432797

I'm trying to clean a file from description, special characters and get only the ID column and the count column without the backslash. I was able to remove the description, but I want to remove the backslash, I used:

sed '/^{/d' GSM2580320_counts.txt | tr '\\' ' ' | grep -vE '^__' GSM2580320_counts.txt> GSM2580320_counts01.txt
cat GSM2580320_counts01.txt | head

This is the output:

ID              Count
ENSG00000005075 459\
ENSG00000005100 1766\
ENSG00000005102 10\
ENSG00000005108 14517\
ENSG00000005156 3101\
ENSG00000005175 867\
ENSG00000005187 6\
ENSG00000005189 307\
ENSG00000005194 1368\
ENSG00000005206 2429\

I tried:

sed 's/\\//g'

Also:

sed 's/\\/ /g'

But not luck!

tail of data:


ENSG00000285991 2\
ENSG00000285992 0\
ENSG00000285993 0\
ENSG00000285994 20\
__no_feature    7388512\
__ambiguous 1016493\
__too_low_aQual 0\
__not_aligned   2087327\
__alignment_not_unique  5970495\
}

head of data:

ENSG00000005075 459\
ENSG00000005100 1766\
ENSG00000005102 10\
ENSG00000005108 14517\
ENSG00000005156 3101\
ENSG00000005175 867\
ENSG00000005187 6\
ENSG00000005189 307\
ENSG00000005194 1368\
ENSG00000005206 2429\
tripleee

You might want to roll everything into a single sed script.

sed -e '/^{/d' -e '/^__/d' -e 's/\\//g' GSM2580320_counts.txt > GSM2580320_counts01.txt

If you only want to remove backslash at end of line, use s/\\$//

For anything more complicated, probably replace sed with Awk.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Remove a string in every line

Remove a comment on every line if it is present

remove every line with criteria except for this different criteria

Remove characters from every line of a file in shell

Remove last character of every nth line in place

How to remove first char of every line in RichTextBox

Remove blank line that appears after every string

Bash, sed, remove last line for every cycle

How to remove every odd line in Notepad++?

Remove backslash from the string

Remove backslash in string with ansible

Swift - remove single backslash

Remove first and last backslash?

How to remove all the duplicated words on every line using Notepad++?

StringJoiner remove delimeter from first position for every line

remove the first 15 characters from every other line in a file

Remove everything in every line after/before the mentioned text using JavaScript

remove every instance of new line between two patterns

Remove every line before a string in file using Ansible

How to remove the first dot from every line but only if it exists

JavaFX - Why there is a line under every Control element and how to remove it?

Remove every even line from textarea using jQuery

Remove play button display at every cell line of Jupyter notebook

Javascript remove spaces in the beginning of every line from innerHTML

How do I remove every second character in all line with Emeditor

Remove everything except some word from every line

Remove every line breaks following carriage return (^M) and join the lines

How can I remove the first whitespace of every line of a file?

How to remove every line starting with specific string from log file?