Sponsored Content
Top Forums Shell Programming and Scripting sed , awk script for printing matched line before regular expression Post 302900701 by clx on Thursday 8th of May 2014 09:32:10 AM
Old 05-08-2014
How this problem is related to your initial problem?
Moreover, if its different, then create a new thread.
Did your initial problem solve with the solutions provided in various posts? We deserve an acknowledgment at least whether it has worked or not.
Still if you are not clear with anything, rephrase your problem with the real example, sample input and output and explain everything you want to achieve and you have tried so far.

Last edited by clx; 05-09-2014 at 08:49 AM.. Reason: typos
These 2 Users Gave Thanks to clx For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk script to move a line after the matched pattern line

I have the following text format in a file which lists the question first and then 5 choices after that the explanantion and finally the answer. 1.The amount of time it takes for most of a worker’s occupational knowledge and skills to become obsolete has been declining because of the... (2 Replies)
Discussion started by: nanchil_guy
2 Replies

2. Shell Programming and Scripting

sed not printing lines before a regular expression.

Hey, I found a way to print the lines which is just before a regular expression, not including the expression. sed -n '/regexp/{n;p;}' myfile Now I'm looking for a way to print all lines, exept the regular expression and also the line before the same regular expression. Use code tags. (1 Reply)
Discussion started by: Livio
1 Replies

3. Shell Programming and Scripting

AWK script issue for the part regular expression

Hi I am having a file as shown below FILE 1 TXDD00, TXDD01, TXDD02, TXDD03, TXDD04, TXDD05, TXDD06, TXDD07, TXDD08, TXDD09, TXDD10, TXDD11, TXDD12, TXDD13, TXDD14, TXDD15, TXDD16, TXDD17, TXDD18, TXDD19, TXDDCLK, TXDJTAGAMPL0, TXDJTAGAMPL1,... (3 Replies)
Discussion started by: jaita
3 Replies

4. Shell Programming and Scripting

AWK Script Issue insert newline for a regular expression match

Hi , I am having an issue with the Awk script to insert newline for a regular expression match Having a file like this FILE1 #################### RXOER , RXERA , RXERC , RXERD .RXEA(RXBSN), RXERD , REXCD input RXEGT buffer RXETRY ####################### Want to match the RXE... (38 Replies)
Discussion started by: jaita
38 Replies

5. Shell Programming and Scripting

matched characters - regular expression

Hi, I read the book of <<unix shell programming>>. The regular expression ^\(.\)\1 matches the first character on the line and stores it in register 1. Then the expression matches whatever is stored in the register 1, as specified by the \1. The net effect of this regular expression is to match... (2 Replies)
Discussion started by: jianma
2 Replies

6. Shell Programming and Scripting

How can I get the matched text when using regular expression.

Hello: (exp) : match "exp",the matched text is stored in auto named arrays. How can I get the matched text ? What is the name of the auto named arrays on linux shell ? (4 Replies)
Discussion started by: 915086731
4 Replies

7. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies

8. UNIX for Advanced & Expert Users

sed: -e expression #1, char 0: no previous regular expression

Hello All, I'm trying to extract the lines between two consecutive elements of an array from a file. My array looks like: problem_arr=(PRS111 PRS213 PRS234) j=0 while } ] do k=`expr $j + 1` sed -n "/${problem_arr}/,/${problem_arr}/p" problemid.txt ---some operation goes... (11 Replies)
Discussion started by: InduInduIndu
11 Replies

9. UNIX for Advanced & Expert Users

Add a line after last matched expression

I thought this would be easy to Google, but I am having trouble getting a clean result that I can understand. I simply want to insert the the line: My Network 192.168.1.1 After the last line that begins with ACL localnet (15 Replies)
Discussion started by: glev2005
15 Replies

10. Shell Programming and Scripting

Help with awk script (syntax error in regular expression)

I've found this script which seems very promising to solve my issue: To search and replace many different database passwords in many different (.php, .pl, .cgi, etc.) files across my filesystem. The passwords may or may not be contained within quotes, single quotes, etc. #!/bin/bash... (4 Replies)
Discussion started by: spacegoose
4 Replies
CGGLSE(l)								 )								 CGGLSE(l)

NAME
CGGLSE - solve the linear equality-constrained least squares (LSE) problem SYNOPSIS
SUBROUTINE CGGLSE( M, N, P, A, LDA, B, LDB, C, D, X, WORK, LWORK, INFO ) INTEGER INFO, LDA, LDB, LWORK, M, N, P COMPLEX A( LDA, * ), B( LDB, * ), C( * ), D( * ), WORK( * ), X( * ) PURPOSE
CGGLSE solves the linear equality-constrained least squares (LSE) problem: minimize || c - A*x ||_2 subject to B*x = d where A is an M-by-N matrix, B is a P-by-N matrix, c is a given M-vector, and d is a given P-vector. It is assumed that P <= N <= M+P, and rank(B) = P and rank( ( A ) ) = N. ( ( B ) ) These conditions ensure that the LSE problem has a unique solution, which is obtained using a GRQ factorization of the matrices B and A. ARGUMENTS
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrices A and B. N >= 0. P (input) INTEGER The number of rows of the matrix B. 0 <= P <= N <= M+P. A (input/output) COMPLEX array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit, A is destroyed. LDA (input) INTEGER The leading dimension of the array A. LDA >= max(1,M). B (input/output) COMPLEX array, dimension (LDB,N) On entry, the P-by-N matrix B. On exit, B is destroyed. LDB (input) INTEGER The leading dimension of the array B. LDB >= max(1,P). C (input/output) COMPLEX array, dimension (M) On entry, C contains the right hand side vector for the least squares part of the LSE problem. On exit, the residual sum of squares for the solution is given by the sum of squares of elements N-P+1 to M of vector C. D (input/output) COMPLEX array, dimension (P) On entry, D contains the right hand side vector for the constrained equation. On exit, D is destroyed. X (output) COMPLEX array, dimension (N) On exit, X is the solution of the LSE problem. WORK (workspace/output) COMPLEX array, dimension (LWORK) On exit, if INFO = 0, WORK(1) returns the optimal LWORK. LWORK (input) INTEGER The dimension of the array WORK. LWORK >= max(1,M+N+P). For optimum performance LWORK >= P+min(M,N)+max(M,N)*NB, where NB is an upper bound for the optimal blocksizes for CGEQRF, CGERQF, CUNMQR and CUNMRQ. If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. INFO (output) INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value. LAPACK version 3.0 15 June 2000 CGGLSE(l)
All times are GMT -4. The time now is 06:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy