How to delete text between two characters in line? | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Unix/Linux Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

How to delete text between two characters in line?

UNIX for Dummies Questions & Answers


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-03-2013
euspilapteryx euspilapteryx is offline
Registered User
 
Join Date: Sep 2009
Last Activity: 3 March 2013, 10:25 AM EST
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
How to delete text between two characters in line?

Hi,

I have a large text file with the following format:

>gi|347545744|gb|JN204951.1| Dismorphia spio voucher 5
ATCAAATTCCTTCCTCTCCTTAAA
>gi|17544664774|gb|WN204922.32| Rodapara nigens gene region
CCGGGCAAATTCCTTCCTCTCCTTAAA
>gi|555466400|gb|SG255122.8| Bombyx mandariana genbank 3
CCGGGCAAATTCCTTCCTCTCCTTAAA

in each line, I would like the text between the ">" and the first space deleted. The text should be outputted like:

>Dismorphia spio voucher 5
ATCAAATTCCTTCCTCTCCTTAAA
>Rodapara nigens gene region
CCGGGCAAATTCCTTCCTCTCCTTAAA
>Bombyx mandariana genbank 3
CCGGGCAAATTCCTTCCTCTCCTTAAA

The lines that need to be edited all begin with ">". Is there a quick way to do this?
Sponsored Links
    #2  
Old Unix and Linux 03-03-2013
anbu23's Unix or Linux Image
anbu23 anbu23 is offline Forum Advisor  
Advisor
 
Join Date: Mar 2006
Last Activity: 16 March 2015, 4:56 AM EDT
Location: Bangalore,India
Posts: 2,136
Thanks: 14
Thanked 150 Times in 143 Posts

Code:
sed "s/^>[^ ]* />/" file

The Following User Says Thank You to anbu23 For This Useful Post:
euspilapteryx (03-03-2013)
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How delete characters of specific line with sed? inaki Shell Programming and Scripting 12 10-23-2012 12:24 PM
delete first 2 characters for each line, please help sunnydanniel Shell Programming and Scripting 4 02-11-2012 11:17 AM
Delete characters from each line lost.identity Shell Programming and Scripting 2 11-15-2010 04:30 PM
Delete new line characters from a file rudoraj Shell Programming and Scripting 4 04-12-2010 02:12 PM
delete duplicated characters in each line ivpz Shell Programming and Scripting 5 12-22-2009 05:57 AM



All times are GMT -4. The time now is 05:22 AM.