03-18-2008
extract multiple sections of file
I have a file that I need to parse multiple sections from the file.
The file contains multiple lines that start with ST (Abunch of data)
Then the file contains multiple lines that start with SE (Abunch of data)
SE*30*0001
ST*810*0002
I need all of the lines between and including these.
They are invoices.
The invoice starts with the ST line and ends with the SE line.
I need to break out all of the invoices into separate files.
Can someone please help me. I know Grep, sed, or AWK can do this, but not sure how.
Thank you
Here is an example:
ST*810*0001
BIG*20080315*1220680417**SUPPLY***DI
N1*SF*MCLANE HIGH PLAINS*92*46120004
N1*ST*SWC 7-11 #57134*91*571315
N3*2712 E 8TH ST
N4*ODESSA*TX*79761
REF*ST*000134
ITD*05*3*****7*****NET 7
IT1**1*CA*20.09**CB*649251*PI*093*UP*099299711018*RA*NA
TXI*ZZ*1.53****2
CTP**RES*0***CSR*1
PID*F****7-11 T-SHIRT BAG 1/7 BBL
PO4*1000
IT1**1*EA*33.72**CB*834861*PI*093*UP*012253022401*RA*NA
TXI*ZZ*2.57****2
CTP**RES*0***CSR*1
PID*F****KIT CONCRETE CHAMP
PO4*1
IT1**1*EA*0.03**CB*192849*PI*093*UP*000000192842*RA*NA
CTP**RES*0***CSR*1
PID*F****SCS 711 BK 200
PO4*1
IT1**30*EA*2.59**CB*001511*PI*093*UP*025215102776*RA*NA
CTP**RES*0***CSR*1
PID*F****MAXELL T-160 PLUS VIDEO
PO4*1
TDS*18454
SAC*C*G740***5300*******06***SERVICE
CTT*4
SE*30*0001
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have a config file with multiple section and a parameter with the same name in each section. I need to read each parameter for distinct section.
Parameter = 1
....
Parameter = 2
....
Parameter = 4
....
Tried this:
grep -m1 '^*ProcessorsNumber' ServiceBrokerFramework.cfg |... (7 Replies)
Discussion started by: potro
7 Replies
2. UNIX for Advanced & Expert Users
I have a file that I need to parse multiple sections from the file.
The file contains multiple lines that start with ST (Abunch of data)
Then the file contains multiple lines that start with SE (Abunch of data)
SE*30*0001 ... (1 Reply)
Discussion started by: rgentis
1 Replies
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
Hello,
I'm wondering where I could go to learn how to edit file sections that cross multiple lines. I'm wanting to write scripts that will add Gnome menu entries for all users on a system for scripts I write, etc. I can search an replace simple examples with sed, but this seems more complex.
... (8 Replies)
Discussion started by: Narnie
8 Replies
5. UNIX for Dummies Questions & Answers
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.... (6 Replies)
Discussion started by: johnshembb
6 Replies
6. Programming
Hi All,
I have a file with the data 10;20;30;40;50;60;70;80;123;145;156;345. the output i want is the first fourth sixth elements and everything from there on. How do i achieve this. (1 Reply)
Discussion started by: raghu_shekar
1 Replies
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
I have a log that looks like below
sc.mng_10_Err.20131020_000000.log:NCSSC_MNG_UP_PE_TO_BE : Failed to change dvc_trx_sts from PE to BE for srvtrx: 213323141427349 dvcsfx: 1
sc.mng_4_Err.20131020_000000.log:NCSSC_MNG_UP_PE_TO_BE : Failed to change dvc_trx_sts from PE to BE for srvtrx:... (6 Replies)
Discussion started by: senormarquez
6 Replies
LEARN ABOUT DEBIAN
dlagv2.f
dlagv2.f(3) LAPACK dlagv2.f(3)
NAME
dlagv2.f -
SYNOPSIS
Functions/Subroutines
subroutine dlagv2 (A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, CSL, SNL, CSR, SNR)
DLAGV2
Function/Subroutine Documentation
subroutine dlagv2 (double precision, dimension( lda, * )A, integerLDA, double precision, dimension( ldb, * )B, integerLDB, double precision,
dimension( 2 )ALPHAR, double precision, dimension( 2 )ALPHAI, double precision, dimension( 2 )BETA, double precisionCSL, double
precisionSNL, double precisionCSR, double precisionSNR)
DLAGV2
Purpose:
DLAGV2 computes the Generalized Schur factorization of a real 2-by-2
matrix pencil (A,B) where B is upper triangular. This routine
computes orthogonal (rotation) matrices given by CSL, SNL and CSR,
SNR such that
1) if the pencil (A,B) has two real eigenvalues (include 0/0 or 1/0
types), then
[ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ]
[ 0 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ]
[ b11 b12 ] := [ CSL SNL ] [ b11 b12 ] [ CSR -SNR ]
[ 0 b22 ] [ -SNL CSL ] [ 0 b22 ] [ SNR CSR ],
2) if the pencil (A,B) has a pair of complex conjugate eigenvalues,
then
[ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ]
[ a21 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ]
[ b11 0 ] := [ CSL SNL ] [ b11 b12 ] [ CSR -SNR ]
[ 0 b22 ] [ -SNL CSL ] [ 0 b22 ] [ SNR CSR ]
where b11 >= b22 > 0.
Parameters:
A
A is DOUBLE PRECISION array, dimension (LDA, 2)
On entry, the 2 x 2 matrix A.
On exit, A is overwritten by the ``A-part'' of the
generalized Schur form.
LDA
LDA is INTEGER
THe leading dimension of the array A. LDA >= 2.
B
B is DOUBLE PRECISION array, dimension (LDB, 2)
On entry, the upper triangular 2 x 2 matrix B.
On exit, B is overwritten by the ``B-part'' of the
generalized Schur form.
LDB
LDB is INTEGER
THe leading dimension of the array B. LDB >= 2.
ALPHAR
ALPHAR is DOUBLE PRECISION array, dimension (2)
ALPHAI
ALPHAI is DOUBLE PRECISION array, dimension (2)
BETA
BETA is DOUBLE PRECISION array, dimension (2)
(ALPHAR(k)+i*ALPHAI(k))/BETA(k) are the eigenvalues of the
pencil (A,B), k=1,2, i = sqrt(-1). Note that BETA(k) may
be zero.
CSL
CSL is DOUBLE PRECISION
The cosine of the left rotation matrix.
SNL
SNL is DOUBLE PRECISION
The sine of the left rotation matrix.
CSR
CSR is DOUBLE PRECISION
The cosine of the right rotation matrix.
SNR
SNR is DOUBLE PRECISION
The sine of the right rotation matrix.
Author:
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
November 2011
Contributors:
Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
Definition at line 157 of file dlagv2.f.
Author
Generated automatically by Doxygen for LAPACK from the source code.
Version 3.4.1 Sun May 26 2013 dlagv2.f(3)