Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help please, extract multiple lines from a text file Post 302412976 by johnshembb on Wednesday 14th of April 2010 06:52:26 AM
Old 04-14-2010
Data Help please, extract multiple lines from a text file

Hi all,

I need to extract lines between the lines 'RD' and 'QA' from a text file (following). there are more that one of such pattern in the file and I need to extract all of them. however, the number of lines between them is varied in the file. Therefore, I can not just use 'grep -A' command. Any suggestion would be appreciated.

Many thanks

---------------------------------------------------------
........
RD FTLH3RB02II3DW 333 0 0
GG**A***AC*AC*ACACACACAC*ACACACACACATGCTTGCACACAAT
CT*GAAATCTTCACTAA*TCTTTATCTTAAATC*AGTT*GGA*T*GTAGA
CAGACACCTGAG*TCATTTAGTCTAATGATGGC*GT*CCCTCACTC*AGG
GCAAGAAATGCTTTCCTCCA*T*GG*A*GAGGTT*AC*AG*TC*TGTT*G
*CC*TCAA*C*TCC*TGTCAGCCTCCAGCTGCTGACA*GG*A**T*CCTG
T*GCCC*TCTC*TT*GT*AGGATGGAGA*GA*TGT*GGTCCTCTATCAAT
TGTACCATCTGTGCTTGTGTGAAAGGCAGG*AC

QA 1 333 1 333
DS CHROMAT_FILE: none PHD_FILE: none TIME: Mon Jan 01 00:00:00 000
........
--------------------------------------------------
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract multiple repeated data from a text file

Hi, I need to extract data from a text file in which data has a pattern. I need to extract all repeated pattern and then save it to different files. example: input is: ST*867*000352214 BPT*00*1000352214*090311 SE*1*1 ST*867*000352215 BPT*00*1000352214*090311 SE*1*2 ... (5 Replies)
Discussion started by: apjneeraj
5 Replies

2. Shell Programming and Scripting

extract the lines between specific line number from a text file

Hi I want to extract certain text between two line numbers like 23234234324 and 54446655567567 How do I do this with a simple sed or awk command? Thank you. ---------- Post updated at 06:16 PM ---------- Previous update was at 05:55 PM ---------- found it: sed -n '#1,#2p'... (1 Reply)
Discussion started by: return_user
1 Replies

3. Shell Programming and Scripting

extract particular lines from text file

I have two files file A which have a number in every row and file B which contains few hundred thousand rows with about 300 characters in each row (csv) What I need is to extract whole rows from B file (only these which numbers are indicated in A file) I also need to use cygwin. Any... (7 Replies)
Discussion started by: gunio
7 Replies

4. Shell Programming and Scripting

[bash help]Adding multiple lines of text into a specific spot into a text file

I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it. For example, Here is a portion of a zone file. IN NS ns1.domain.tld. IN NS ns2.domain.tld. IN ... (2 Replies)
Discussion started by: cdn_humbucker
2 Replies

5. Shell Programming and Scripting

Extract strings from multiple lines into one file -

input file Desired csv output gc_type, date/time, milli secs af, Mar 17 13:09:04 2011, 144.596 af, Mar 20 00:37:37 2011, 144.242 af, ar 20 21:30:59 2011, 108.518 Hi All, Any help in acheiving the above would be appreciated. I would like to parse through lines within one file and... (5 Replies)
Discussion started by: satish.vampire
5 Replies

6. Shell Programming and Scripting

Extract strings from multiple lines into one csv file

Hi all, Please go through my requirement. I have a log file in the location /opt/WebSphere61/AppServer/profiles/EMQbatchprofile/logs/EMQbatch This file contains the follwing pattern data <af type="tenured" id="42" timestamp="May 14 13:44:13 2011" intervalms="955.624"> <minimum... (8 Replies)
Discussion started by: satish.vampire
8 Replies

7. Shell Programming and Scripting

Extracting Multiple Lines from a Text File

Hello. I am sorry if this is a common question but through all my searching, I haven't found an answer which matches what I want to do. I am looking for a sed command that will parse through a large text file and extract lines that start with specific words (which are repeated throughout the... (4 Replies)
Discussion started by: MrDumbQuestion
4 Replies

8. Shell Programming and Scripting

Process multiple lines in a text file

Hi All I have text file like this: a=21ej c=3tiu32 e=hydkehw f=hgdiuw g=jhdkj a=klkjhvl b=dlkjhyfd a=yo c=8732 Any way I can process data from first a to just before of second a, and then second a to just before of 3rd one. Just fetching records like that will help, I mean... (3 Replies)
Discussion started by: sandipjee
3 Replies

9. UNIX for Dummies Questions & Answers

How to grep multiple lines from a text file using another text file?

I would like to use grep to select multiple lines from a text file using a single-column text file. Basically I want to only select lines from the first text file where the second column of the first text file matches the second text file. How do I go about doing that? Thanks! (5 Replies)
Discussion started by: evelibertine
5 Replies

10. Shell Programming and Scripting

Extract a pattern from multiple lines in a file

I have a file that has some lines starts with * I want to get these lines, then get the word between "diac" and "lex". ex. file: ;;WORD AlAx *0.942490 diac:Al>ax lex:>ax_1 bw:Al/DET+>ax/NOUN+ gloss:brother pos:noun prc3:0 prc2:0 prc1:0 prc0:Al_det per:na asp:na vox:na mod:na gen:m num:s... (4 Replies)
Discussion started by: Viernes
4 Replies
smistrip(1)							     SMI Tools							       smistrip(1)

NAME
smistrip - extract MIB or PIB modules from text files, like RFCs or I-Ds SYNOPSIS
smistrip [ -Vhn ] [ -d dir ] [ -m module ] [ file(s) ] DESCRIPTION
The smistrip program is used to extract MIB and PIB module files from ASCII documents like RFCs or Internet Drafts. Modules are identified by a starting ASN.1 DEFINITIONS clause and the matching END clause. The output is written to files named by the modules' names. OPTIONS
-V Show the smistrip version and exit. -h Show a help text and exit. -n Print only what would be extracted, but do not write any output file. -d dir Write module file(s) to directory dir instead of the current working directory. -m module Extract only the module module instead of all modules found in the input file(s). file(s) The input text file(s) from which modules will be extracted. If no file is given, input is read from stdin. Note that smistrip tries to be smart about locating module start and end, detecting page breaks and blank lines near page breaks. It also tries to cut off blank prefixing columns from all lines of a modules. However, there might by documents that cannot be parsed correctly by smistrip and probably produce incorrect output. You might consider to use smilint on every extracted module file to check its syntactical correctness. EXAMPLE
This example extracts only the module IPV6-MIB from the file rfc2465 and writes it to the directory /usr/local/tmp. $ smistrip -d /usr/local/tmp -m IPV6-MIB rfc2465 SEE ALSO
The libsmi(3) project is documented at http://www.ibr.cs.tu-bs.de/projects/libsmi/. smilint(1) AUTHOR
(C) 1999-2004 F. Strauss, TU Braunschweig, Germany <strauss@ibr.cs.tu-bs.de> (C) 2002 M. Bunkus, TU Braunschweig, Germany <bunkus@ibr.cs.tu-bs.de> and contributions by many other people. IBR
August 10, 2004 smistrip(1)
All times are GMT -4. The time now is 01:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy