Sponsored Content
Full Discussion: Merge broken lines
Top Forums Shell Programming and Scripting Merge broken lines Post 302623249 by birei on Friday 13th of April 2012 10:20:15 AM
Old 04-13-2012
Hi ashwin_winwin,

One way with sed:
Code:
$ cat infile
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000100¦201203161000¦B¦32 ¦2WN¦EUS-¦MAN¦VAS¦4827¦TTL011 ¦
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000101¦201203161000¦B¦25 ¦2WN¦EUS-¦MAN¦VAS¦4827¦TTL011 ¦
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000102¦201203161000¦B¦30 ¦2GN¦EUS-¦MAN¦VCD¦2102¦RJ42034N¦
MR JAMES LUETCHFORD
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000103¦201203161000¦B¦29 ¦2WN¦EUS-¦MAN¦VAS¦4827¦TTL011 ¦
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000104¦201203161000¦B¦36 ¦2WN¦EUS-¦MAN¦VCD¦2102¦RJ42034N¦
MR JAMES LUETCHFORD
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000105¦201203161000¦B¦35 ¦2GN¦EUS-¦MAN¦VCD¦2102¦RJ42034N¦
MR JAMES LUETCHFORD
$ sed -n ':a ; N ; s/^\n// ; /\nmr james luetchford/I { h ; s/\n// ; p ; s/^.*$// ; ba }; $ { p ; q }; /\n/ { P ; D }; ba' infile 
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000100¦201203161000¦B¦32 ¦2WN¦EUS-¦MAN¦VAS¦4827¦TTL011 ¦
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000101¦201203161000¦B¦25 ¦2WN¦EUS-¦MAN¦VAS¦4827¦TTL011 ¦
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000102¦201203161000¦B¦30 ¦2GN¦EUS-¦MAN¦VCD¦2102¦RJ42034N¦MR JAMES LUETCHFORD
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000103¦201203161000¦B¦29 ¦2WN¦EUS-¦MAN¦VAS¦4827¦TTL011 ¦
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000104¦201203161000¦B¦36 ¦2WN¦EUS-¦MAN¦VCD¦2102¦RJ42034N¦MR JAMES LUETCHFORD
SEAT-RES¦$D0317.PBOUC32A.GURD3591 ¦00000105¦201203161000¦B¦35 ¦2GN¦EUS-¦MAN¦VCD¦2102¦RJ42034N¦MR JAMES LUETCHFORD

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk / shell - Fix broken lines and data

Gurus, I am struggling with a issue and thought I could use some of your expertise. Need Help with this I have a flat file that has millions of records 24|john|account ~ info |56| 25|kuo|account ~ journal |58| 27|kim|account ~ journal |59| 28|San|account ~ journal |60|... (3 Replies)
Discussion started by: rimss
3 Replies

2. Shell Programming and Scripting

Merge two lines

Hi I have two lines of data formatted as displayed below shop, price, remark, date a,#N/A,order to -fd, 20091011 and would like it to be shop:a price:#N/A remark:order to -fd date:20091011 How can I do it? Many thanks (2 Replies)
Discussion started by: lalelle
2 Replies

3. Shell Programming and Scripting

remove blank lines and merge lines in shell

Hi, I'm not a expert in shell programming, so i've come here to take help from u gurus. I'm trying to tailor a csv file that i got to make it work for the LOAD FROM command. I've a datatable csv of the below format - --in file format xx,xx,xx ,xx , , , , ,,xx, xxxx,, ,, xxx,... (11 Replies)
Discussion started by: dvah
11 Replies

4. Shell Programming and Scripting

Joining broken lines

I have a plain test file with a delimeter ''. In this file some lines are broken into two. The first part of these broken line will have 6 columns and the second part will have 4. These broken lines will be consicutive. I want to join the two consicutive lines which are having 6 fields and 4... (8 Replies)
Discussion started by: ratheeshjulk
8 Replies

5. UNIX for Dummies Questions & Answers

How to identify broken lines in a file?

Hi, I have a 100 byte length fixed width file . In that three rows are broken and went off to next line. How can I identify the broken lines? E.g. ABCD1234MNRD4321 abcd1234mnrd 4321 As you can see in my example my second row with small case alphabets is broken... (5 Replies)
Discussion started by: okkadu
5 Replies

6. Shell Programming and Scripting

Merge lines

Hello I have a file with CAR 23 COLOR 12 CAR 44 COLOR 12 CAR 55 COLOR 20 SIZE BIG CAR 56 CAR 57 COLOR 11 How can merge the CAR and the COLOR + SIZE (if there are COLOR,SIZE) CAR 23 COLOR 12 CAR 44 COLOR 12 CAR 55 COLOR 20 SIZE BIG CAR 56 CAR 57 COLOR 11 Every line begin in... (4 Replies)
Discussion started by: sharong
4 Replies

7. Shell Programming and Scripting

Joining broken lines with awk or perl

Hi, I have a huge file with sql broken statements like: PP3697HB @@@@0 <<<<<<Record has been deleted as per PP3697HB>>>>>> FROM sys.xtab_ref rc,sys.xtab_sys f,sys.domp ur WHE RE rc.milf = ur.milf AND rc.molf = f.molf AND ur.dept = 'SWIT'AND ur .department = 'IND' AND share = '2' AND... (4 Replies)
Discussion started by: som.nitk
4 Replies

8. Shell Programming and Scripting

Merge Lines

Hello I have an input as below this is test we are( ) one end of description I am looking for output this is test we are () one end of description (2 Replies)
Discussion started by: Tomlight
2 Replies

9. Shell Programming and Scripting

Joining broken lines and removing empty lines

Hi - I have req to join broken lines and remove empty lines but should NOT be in one line. It has to be as is line by line. The challenge here is there is no end of line/start of line char. thanks in advance Source:- 2003-04-34024|04-10-2003|Claims|Claim|01-13-2003|Air Bag:Driver;... (7 Replies)
Discussion started by: Jackceasar123
7 Replies
cla_lin_berr.f(3)						      LAPACK							 cla_lin_berr.f(3)

NAME
cla_lin_berr.f - SYNOPSIS
Functions/Subroutines subroutine cla_lin_berr (N, NZ, NRHS, RES, AYB, BERR) CLA_LIN_BERR Function/Subroutine Documentation subroutine cla_lin_berr (integerN, integerNZ, integerNRHS, complex, dimension( n, nrhs )RES, real, dimension( n, nrhs )AYB, real, dimension( nrhs )BERR) CLA_LIN_BERR Purpose: CLA_LIN_BERR computes componentwise relative backward error from the formula max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) ) where abs(Z) is the componentwise absolute value of the matrix or vector Z. Parameters: N N is INTEGER The number of linear equations, i.e., the order of the matrix A. N >= 0. NZ NZ is INTEGER We add (NZ+1)*SLAMCH( 'Safe minimum' ) to R(i) in the numerator to guard against spuriously zero residuals. Default value is N. NRHS NRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrices AYB, RES, and BERR. NRHS >= 0. RES RES is DOUBLE PRECISION array, dimension (N,NRHS) The residual matrix, i.e., the matrix R in the relative backward error formula above. AYB AYB is DOUBLE PRECISION array, dimension (N, NRHS) The denominator in the relative backward error formula above, i.e., the matrix abs(op(A_s))*abs(Y) + abs(B_s). The matrices A, Y, and B are from iterative refinement (see cla_gerfsx_extended.f). BERR BERR is COMPLEX array, dimension (NRHS) The componentwise relative backward error from the formula above. Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: November 2011 Definition at line 102 of file cla_lin_berr.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.1 Sun May 26 2013 cla_lin_berr.f(3)
All times are GMT -4. The time now is 03:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy