Extract all the content after a specific data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extract all the content after a specific data
# 15  
Old 11-05-2009
I also feel weird about it Smilie
Really thanks for your help and patience and explanation all the time, ahmad ^^
# 16  
Old 11-05-2009
Hi Patrick, do these commands fail too?
Code:
sed -n '/>seq_8$/,$p' infile

Code:
awk '/>seq_8$/,0' infile

# 17  
Old 11-05-2009
Thanks a lot, ahmad and sorry for disturbing you Smilie
You're right. All of your command or code work perfectly for my test sequence.
I just found out that I did a careless mistakes when run the code that you suggested Smilie
Really thanks a lot for your help.
My problem is solved finally ^^

---------- Post updated at 08:23 PM ---------- Previous update was at 08:21 PM ----------

Hi Scrutinizer,
Thanks a lot for your suggestion code ^^
Both of your code and ahmad suggested's code work perfectly for my test sequence.
Sorry that my careless mistakes create trouble for you all Smilie

---------- Post updated at 09:53 PM ---------- Previous update was at 08:23 PM ----------

Hi, I just found out that both of your suggested code, will print out all those sequence after seq_8 as well Smilie
Do you got better idea, just let it extract only seq_8 ?
Really thanks for your help ^^

---------- Post updated at 09:58 PM ---------- Previous update was at 09:53 PM ----------

Hi Ahmad,
the same problem as Scrutinizer's code, happen to your suggested code as well Smilie
It will extract all those sequence content after seq_8 as well Smilie
# 18  
Old 11-06-2009
Well that is what you asked for:
Quote:
Originally Posted by patrick87
[..] My output: Extract all the data after seq_3:
>seq_8
RTTGLSERPRLPTTASRSISSRWTR
>seq_10
NELPLEKGSLDSISIE
>seq_9
PNQGDAREPQAHLPRRQGPRDRPLQAYA+
QVQHRRHDHSRTQH*LCRRRQREDCDRLHR
>seq_4
DRGKGQAGCRRPQEGEALVRRCS>seq_6
FA*GLAAQDGEA*SGRG
Or is that not what you mean? Can you give a better sample input and output:

Last edited by Scrutinizer; 11-06-2009 at 12:35 AM..
# 19  
Old 11-06-2009
Oic.
Sorry for let you misunderstanding my question.
I apologize and sorry for it Smilie
My thread one's problem already solved by ahmad ^^
Regarding to thread number 5,
Actually I just asking about how to extract only those content that matched with seq_8.
At this time, input :
>seq_1
DSASSTRRARRRRTPRTPSLRSRRSDVTCS
>seq_3
RMRLRRWRKSCSERS*RRSN
>seq_8
RTTGLSERPRLPTTASRSISSRWTR
>seq_10
NELPLEKGSLDSISIE
>seq_9
PNQGDAREPQAHLPRRQGPRDRPLQAYA+
QVQHRRHDHSRTQH*LCRRRQREDCDRLHR
>seq_4
DRGKGQAGCRRPQEGEALVRRCS>seq_6
FA*GLAAQDGEA*SGRG

My output: Extract only the data of seq_8:
>seq_8
RTTGLSERPRLPTTASRSISSRWTR

Sorry again, Scrutinizer.
I will notice my mistakes in future.
Hope for your understanding.
sorry Smilie
# 20  
Old 11-06-2009
Quote:
Do you got better idea, just let it extract only seq_8 ?
Code:
awk '$1~/>/{f=0}/>seq_8$/{f=1}f' file

Too many examples, too many solutions.
You should start solving your own problems Smilie
# 21  
Old 11-06-2009
Thanks a lot and a lot, danmero.
This times your code run perfectly and solved my trouble that make me confusing this few days ^^
I believe the reason that I keep on got different output result maybe due to the different version of awk and sed that I used at two different computer server.
hehe.
I do this careless and stupid mistakes Smilie
And guilty to let you all busy to help me solve it .
I really appreciate all of your help ^^
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How-To Extract specific data from a file.

data.txt has several information like the below.. <SERVER>:WEB:MYDOM01:/tmp/cong/MYDOM01,/tmp/app/MYDOM01 <WEBER>:CANES:https-web01,https-web02:/web/apps/https-web01/config <SERVER>:WEB:MYDOM07:/tmp/cong/MYDOM07,/tmp/app/MYDOM07... (7 Replies)
Discussion started by: mohtashims
7 Replies

2. Shell Programming and Scripting

How to extract specific data?

Bash scripting beginner here... I have many folders, each folder representing one subject. Not all subjects have all the required files, so I need to somehow cycle through all the data and then extract the data only from subjects who have no files missing. I tried to output the ls command, but... (4 Replies)
Discussion started by: LeftoverStew
4 Replies

3. Shell Programming and Scripting

Extract all content that match exactly only specific word

Input: 21 templeta parent 35718 36554 . - . ID=parent_cluster_50.21.11; Name=Partial%20parent%20for%20training%20set; 21 templeta kids 35718 36554 . - . ID=_52; Parent=parent_cluster_5085.21.11; 21 templeta ... (7 Replies)
Discussion started by: patrick87
7 Replies

4. Shell Programming and Scripting

Extract specific data and change its arrangment

Input: HS04636 PROGRAM source 836 7001 + ID=g1 HS04636 PROGRAM beginner 836 7001 + ID=g1.t1;Parent=g1 HS04636 PROGRAM position 836 836 + Parent=g1.t1 HS04636 PROGRAM type 836 1017 + Parent=g1.t1 HS04636 ... (2 Replies)
Discussion started by: patrick87
2 Replies

5. Shell Programming and Scripting

Extract specific content from data and rename its header problem asking

Input file 1: >pattern_5 GAATTCGTTCATGTAGGTTGASDASFGDSGRTYRYGHDGSDFGSDGGDSGSDGSDFGSDF ATTTAATTATGATTCATACGTCATATGTTATTATTCAATCGTATAAAATTATGTGACCTT SDFSDGSDFKSDAFLKJASLFJASKLFSJAKJFHASJKFHASJKFHASJKFHSJAKFHAW >pattern_1 AAGTCTTAAGATATCACCGTCGATTAGGTTTATACAGCTTTTGTGTTATTTAAATTTGAC... (10 Replies)
Discussion started by: patrick87
10 Replies

6. Shell Programming and Scripting

Way to extract detail and its content above specific value problem asking

Input file: >position_10 sample:68711 coords:5453-8666 number:3 type:complete len:344 MSINQYSSDFHYHSLMWQQQQQQQQHQNDVVEEKEALFEKPLTPSDVGKLNRLVIPKQHA ERYFPLAAAAADAVEKGLLLCFEDEEGKPWRFRYSYWNSSQSYVLTKGWSRYVKEKHLDA NRTS* >position_4 sample:68711 coords:553-866 number:4 type:partial len:483... (7 Replies)
Discussion started by: patrick87
7 Replies

7. Shell Programming and Scripting

Extract specific read from a data

Input file: #abc_1 SAASFASFGGDSGDSGDSGSDGSDGSDGSDGSDGSDGSDGDS Output file: FASFGGDSGDS I just want to print out the read from position 5 until position 15 from the data. Below is the code that I just try but it is failed to get my desired output: grep -v '#' input_file | awk... (5 Replies)
Discussion started by: patrick87
5 Replies

8. Shell Programming and Scripting

Extract specific data content from a long list of data

My input: Data name: ABC001 Data length: 1000 Detail info Data Direction Start_time End_time Length 1 forward 10 100 90 1 forward 15 200 185 2 reverse 50 500 450 Data name: XFG110 Data length: 100 Detail info Data Direction Start_time End_time Length 1 forward 50 100 50 ... (11 Replies)
Discussion started by: patrick87
11 Replies

9. Shell Programming and Scripting

Extract specific content from a file

My input file: >sequence_1 ASSSSSSSSSSSDDDDDDDDDDDCCCCCCC ASDSFDFFDFDFFWERERERERFSDFESFSFD >sequence_2 ASDFDFDFFDDFFDFDSFDSFDFSDFSDFDSFASDSADSADASD ASDFFDFDFASFASFASFAFSFFSDASFASFASFAFS >sequence_3 VEDFGSDGSDGSDGSDGSDGSDGSDG dDFSDFSDFSDFSDFSDFSDFSDFSDF SDGFDGSFDGSGSDGSDGSDGSDGSDG My... (22 Replies)
Discussion started by: patrick87
22 Replies

10. Shell Programming and Scripting

Shell script or command help to extract specific contents from a long list of content

Hi, I got a long list of contents: >sequence_1 ASSSSSSSSSSSDDDDDDDDDDDCCCCCCC ASDSFDFFDFDFFWERERERERFSDFESFSFD >sequence_2 ASDFDFDFFDDFFDFDSFDSFDFSDFSDFDSFASDSADSADASD ASDFFDFDFASFASFASFAFSFFSDASFASFASFAFS >sequence_3 VEDFGSDGSDGSDGSDGSDGSDGSDG dDFSDFSDFSDFSDFSDFSDFSDFSDF... (2 Replies)
Discussion started by: patrick87
2 Replies
Login or Register to Ask a Question