On Wednesday 19 May 2004, austin at slide-recordings.com (austin) wrote:
>Hi Folks,
>>Just wondering if anyone can give me a quick solution to a pretty
>straightforward problem. I have a text file of DNA sequences. Each sequence
>has at the top a header
>>>Unique Identifier blah blah blah
>sequence
>>The unique identifier is 4 letters and 3 numbers. Basically i want to parse
>the file and append it with some extra info ie
>>>Unique Identifier NEW TEXT blah blah blah
>sequence
>>the new text i want to insert is one number and 5 letters and is exactly the
>same in each. I am assuming that i can use something straightforward on the
>command line to do this but, possibly due to it being early in the morning
>and not having had enough coffee, I cant seem to figure anything out. If
>anyone has any ideas they would be hugely appreciated as I need to try and
>sort this problem out asap.
sed or perl (or vi or emacs) will do the trick. But before giving a specific
answer, you need to state the problem more specifically. Can you state with
certainty that ONLY header lines will begin with 4 letters and 3 numbers (it
has to be possible to identify the header lines somehow) ? Is NEW TEXT the
same for every header or does it depend on the header?
Niall
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!