-1

I don't know how to edit some text files and make my job easier. How can I get specific lines inside a enourmous text file, grab it and send to another text file (a new document).

Example 1:

>text_xyz

ASDFGHJKLJGDSAQWEERTYYGFS

.>text_abc

ASDFWQRTYGEQ

So, I need to find those terms (>text_xyz) and grab the lines under the title (ASDFGHJKLJGDSAQWEERTYYGFS).

I think this isn't a difficult job, because when I find the starting code ">" I just need to stop "grabing" when I find another code starting with ">" .

Then, I'll get only those lines:

**>text_xyz**

**ASDFGHJKLJGDSAQWEERTYYGFS**

How can I do this using Linux terminal?

Braiam
  • 1
  • 11
  • 47
  • 78
aliochka
  • 1
  • 1
  • i `grep` is the way to go also putting the grep in a shell script would make it portable and a lot easier. – jgr208 Oct 06 '14 at 13:45
  • possible duplicate of [Printing a sequence from a fasta file](http://stackoverflow.com/questions/26144692/printing-a-sequence-from-a-fasta-file) – tripleee Oct 06 '14 at 14:42

1 Answers1

0

grep -A 1 foo text_xyz > new.txt

jgr208
  • 2,896
  • 9
  • 36
  • 64