0

I have the following information:

gene            complement(297183..300379)
                 /Name="Sp34_10006520"
                 /EC_number=3.2.1.45
gene            334670..335559
                 /Name="Sp34_10007100"
                 /EC_number=4.2.1.17

I want the output like this:

gene            complement(297183..300379)
                 /Name="Sp34_10006520"
                 /EC_number="3.2.1.45"
gene            334670..335559
                 /Name="Sp34_10007100"
                 /EC_number="4.2.1.17"

I want to put the "" marks after finding the /EC_number=. Please guys help me out

  • this is the 3rd question today related to file with gene... how about trying to solve yourself... – Sundeep Apr 20 '17 at 10:44
2

You can do:

sed 's/EC_number=\(.*\)/EC_number="\1"/' file

Or:

sed -E 's/EC_number=(.*)/EC_number="\1"/' file

Or:

perl -pe 's/(EC_number=)(.*)/$1"$2"/' file

Or:

awk -F= '/EC_number/{$2="\""$2"\""}1' file 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.