Proper sed format to remove and of line characters?
1
0
Entering edit mode
5.4 years ago
stacy734 ▴ 40

Hi everyone,

I have a fasta file with some junk at the end of many lines, which I would like to remove using sed.

I have tried these formats, but am getting errors inre illegal variable names:

sed -e "s/NNG$//g"

sed -e "s/NNG\$//g"

sed -e "s/NNG$//g"

sed -e "s/NNG+$//g"

sed -e "s/NNG*$//g"

I'm stumped. Any advice will be appreciated.

sed fasta • 1.2k views
ADD COMMENT
1
Entering edit mode

Hello,

try to use ' instead of ".

fin swimmer

ADD REPLY
0
Entering edit mode

Thanks finswimmer.

Sadly, that didn't seem to solve the problem.

ADD REPLY
1
Entering edit mode

Hello stacy734 ,

please use the ADD REPLY button below the post you like to reply to.

Could you please:

  • post an example of the input file
  • post the exact error message you receive
  • tell us what OS you are using
  • tell which shell (bash?, zsh?, ...) you are using

?

Thanks!

fin swimmer

ADD REPLY
0
Entering edit mode

Show us an example of a fasta sequence with what you want to remove

ADD REPLY
0
Entering edit mode
5.4 years ago
jcabraham • 0

You're matching , or "all of []" Try "." instead, or "match all occurences of [anything]":

sed -e 's/NNG.*$//'

# Input
goodNNGS
goodNNGS
goodNNGC
goodNNGA

# Output
good
good
good
good
ADD COMMENT

Login before adding your answer.

Traffic: 1508 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6