943,921 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 804
  • C++ RSS
May 28th, 2009
0

how can i Search in text files and copy the characters

Expand Post »
I have a text file with something like this in it:
>ENSG00321 Gene_ch19 . . . .
AATAGCGGTTAACATATTAATTAAACTAATGTATAGATATTATCCGCTTCCAGATTTATTATTTTGTAAA
ATAGGCACAGTTCTTATCTGGTGTCACTTTATGCTTTTTTAATAGACGCCCAGCTCTACTCATGGCCAAG
.
.
>ENSG00531 Gene_ch5 . . . .
AAAGAAGCGTAGGCCCGCCATGCAGCGTAAAAAGGATAATGCGGAGCAGCGGTCCCCAAAGACTGATTTA
TCAAAACTGTTTTCGCAGCAATTAACACACCCACCGACCAGTAACACCGCTGCAAGCAAGGCCACGGGCA
.
.
I have some headers like (ENSG00321) too.
I want to search in text files with header and then get characters(AGCT, characters line start from below of the header line) from 5 to 100 of that header and copy to a new text file.
How can I programming this? In MATLAB or PERL or C++.
Last edited by vahiddani; May 28th, 2009 at 10:37 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vahiddani is offline Offline
2 posts
since May 2009
May 28th, 2009
0

Re: how can i Search in text files and copy the characters

You just want to copy lines 5-100 out of one file and into another file? You could use c++ for that - look into fstream and cin.getline()
Featured Poster
Reputation Points: 437
Solved Threads: 204
Posting Virtuoso
daviddoria is offline Offline
1,968 posts
since Feb 2008
May 28th, 2009
0

Re: how can i Search in text files and copy the characters

not always from 5th character. it can be different. i want find Header and then read characters from special character like 5th or 41th or etc and then read special number of characters start from 5th(ex, 100 or 102 or etc) and then copy and write them to another file. I have the address of headers and start character, and number of characters for each headers that must be read and copy from start character.
like this:
5th char "start to read 112 character after 5th character" so, end of string that will be copy must be 117th character.
Also there are a lot of headers and their characters in text file. i have the address of headers and their characters, that should be copy.
Last edited by vahiddani; May 28th, 2009 at 11:37 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vahiddani is offline Offline
2 posts
since May 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: appending numbers to a name
Next Thread in C++ Forum Timeline: PLZ someone tell me what is wrong with my program!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC