Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help! Searching and extracting information...

Status
Not open for further replies.

Captainrave

Technical User
Nov 16, 2007
97
GB
It has been a while since I have coded anything and I need help. I always seem to find the answers here, and you are all much more skilled than I am!

So I have a file that has a list of numbers like so (in csv format):

2923044 2924240
2926739 2928907
2935683 2936888
2939169 2940560
2941959 2942579

I then want to locate these numbers in another file that is in the format:

CDS 1..1920
/product="tRNA uridine 5-carboxymethylaminomethyl odification enzyme GidA"
/protein_id="NP_878920.1"
CDS 2000..2450
/product="tRNA uridine 5-carboxymethylaminomethyl odification enzyme GidB"

etc...

Basically everytime it finds one of these numbers I need it to pull out the information contained within the " and " of /product. Note that there may be other fields between CDS and product, however only ONE /product will be found for each set of numbers found.

I then need these output as a list like:

2923044 2924240 Productname from /product"name"
2926739 2928907 Productname from /product"name" etc...

I also need the script to ASK for the name of the file to be input and the name of the output file! Ideally the output would be csv.

 
What have you got so far? Remember this is a help forum, not a coding service.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top