Jump to content

Recommended Posts

Lets say i have a text file

[code]

HEADER    LIPID TRANSPORT                         23-SEP-97   1AV1              
TITLE     CRYSTAL STRUCTURE OF HUMAN APOLIPOPROTEIN A-I                        
COMPND    MOL_ID: 1;          
Model           1
12345
12345
67890
67890
END
Model           2
23456
23456
17890
17890
END
[/code]

Question one: how do i read the lines begining with TITLE? I need a script to ouput what comes after TITLE, In this case, I need the script to output CRYSTAL STRUCTURE OF HUMAN APOLIPOPROTEIN A-I

Question two: How do i read the data between 2 lines? Lets say, if i want to read the data between Model 1 and Model 2, the script should output
[code]
12345
12345
67890
67890
END
[/code]

How do i go this?
Can i do it using linux system commands?
Link to comment
https://forums.phpfreaks.com/topic/12099-php-text-operations/
Share on other sites

Hmmm...

Kind of like asking how do I fix an engine.. are the bolts metric or US, are they left hand thread or right etc etc.

In other words, start with the structure of the file...

does each line end with the same 'character', such that said 'character' is ONLY used to end lines.

does each line represent a unqiue piece or group of information? and if it is a 'group' how are the pieces DISTINCTIVELY separated?

Will the file and subsequent versions of it follow the same format?

Those kinds of questions and answers about the file will narrow down the method of using the information in the file simply and effectively.

do a google search on php file handling read write

Lite....
Link to comment
https://forums.phpfreaks.com/topic/12099-php-text-operations/#findComment-46085
Share on other sites

[!--quoteo(post=384370:date=Jun 15 2006, 04:15 PM:name=litebearer)--][div class=\'quotetop\']QUOTE(litebearer @ Jun 15 2006, 04:15 PM) [snapback]384370[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hmmm...

Kind of like asking how do I fix an engine.. are the bolts metric or US, are they left hand thread or right etc etc.

In other words, start with the structure of the file...

does each line end with the same 'character', such that said 'character' is ONLY used to end lines.

does each line represent a unqiue piece or group of information? and if it is a 'group' how are the pieces DISTINCTIVELY separated?

Will the file and subsequent versions of it follow the same format?

Those kinds of questions and answers about the file will narrow down the method of using the information in the file simply and effectively.

do a google search on php file handling read write

Lite....
[/quote]

Each group of data is seperated by MODEL Number and END

Like

[code]
Model 1
1234
1234
1234
END
Model 2
asdf
asdf
asdf
END
Model 3
uyiopityu
tryopitry
tryopiyp
END
[/code]

I cant seem to find to any code to extract just model 1,2 or 3.

Link to comment
https://forums.phpfreaks.com/topic/12099-php-text-operations/#findComment-46089
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.