Sponsored Content
Top Forums Shell Programming and Scripting Print whole line if variables matches Post 302975692 by RavinderSingh13 on Friday 17th of June 2016 08:58:43 AM
Old 06-17-2016
Quote:
Originally Posted by nypreH
I ran this command and got nothig in output.
I also changed spaces which separates each column with ^ and tried previous suggested command, but also got nothing:

Code:
awk -F"^" 'NR==FNR{c[$1$2]++;next};c[$1$2] > 0' /tmp/featureCodesAndCapacity /tmp/featureCode1stPart

file1
Code:
[105km Extended Cell for CS]_[1219]_Capacity^754^NBSC01 ^105km_Extended_Cell_for_CS
[105km Extended Cell for CS]_[1219]_Capacity^754 ^NBSC01 ^105km_Extended_Cell_for_CS
[AIS FE BTS]_[587]_Capacity^2700^NBSC01 ^AIS_FE_BTS
[AIS FE BTS]_[587]_Capacity^2700 ^NBSC01 ^AIS_FE_BTS
[Lb Interface basic]_[16]_Capacity^1^NBSC01 ^Lb_Interface_basic
[Lb Interface basic]_[16]_Capacity^1 ^NBSC01 ^Lb_Interface_basic
[Lb AGPS]_[19]_Capacity^1^NBSC01 ^Lb_AGPS
[Lb AGPS]_[19]_Capacity^1 ^NBSC01 ^Lb_AGPS
[Lb UTDOA]_[20]_Capacity^1^NBSC01 ^Lb_UTDOA
[Lb UTDOA]_[20]_Capacity^1 ^NBSC01 ^Lb_UTDOA
[L3 functionality for ESB switch]_[1234]_Capacity^6^NBSC01 ^L3_functionality_for_ESB_switch

file2
Code:
1234^4
7^16
4^1321
2^1321
14^389
1^1780
13^38
73^584
393^0
591^0
834^0
673^0
909^30
1015^0
1262^1807
1273^0
1219^0
1379^1196
3730^85
1826^3
16^0
19^0
20^0

Hello nypreH,

Could you please check into your Input_file if there are garbage characters in the Input_files mentioned by you by doing following.
Code:
cat -v Input_file1

If above gives garbage characters then you could do following to remove them.
Code:
tr -d '\r' < Input_file1 > new_Input_file1
tr -d '\r' < Input_file2 > new_Input_file2
mv new_Input_file1  Input_file1
mv new_Input_file2  Input_file2

Then could you please try my command in POST#4 and let us know how it goes then.

Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print next line if matches a particular word..need help

Hi i need a help for making a script whch can print next line if it matches a particular word like file1 have ename Mohan eid 2008 ename Shyam eid 345 if scipt got Mohan it will print next line (eid 2008) pls help me .......:) (2 Replies)
Discussion started by: anish19
2 Replies

2. Shell Programming and Scripting

Print line if first Field matches a pattern

Hi All, I would like my code to be able to print out the whole line if 1st field has a dot in the number. Sample input and expected output given below. My AWK code is below but it can;t work, can any expert help me ? Thanks in advance. {if ($1 ~ /*\.*/) { print $0 }} Input: ... (2 Replies)
Discussion started by: Raynon
2 Replies

3. Shell Programming and Scripting

How to print line if field matches?

Hi all, I got several lines line this a b c d e 1 e a 1 c d e 3 f a b c 1 e 8 h a b c d e 1 w a 1 c d e 2 w a b c d e 1 t a b c d e 7 4 How can I print the line if 1 is the field one before the last field? Basicly this 2 field ? a b c d e 1 e a b c d e 1 t The file I got is... (7 Replies)
Discussion started by: stinkefisch
7 Replies

4. UNIX for Advanced & Expert Users

Print line if subsrt matches array

Hi Folks! im printing all lines where the characters in position 270-271 match 33|H1|HA|KA|26 so i came up with this #!/bin/bash array=(33 H1 HA KA 26 ) for i in "${array}" do #echo $i awk '{ if (substr($0,270,2)~'/$i/') print; }' $1 >> $1.temp done It works fine . but... (2 Replies)
Discussion started by: phpsnook
2 Replies

5. Shell Programming and Scripting

Using regex's from file1, print line and line after matches in file2

Good day, I have a list of regular expressions in file1. For each match in file2, print the containing line and the line after. file1: file2: Output: I can match a regex and print the line and line after awk '{lines = $0} /Macrosiphum_rosae/ {print lines ; print lines } ' ... (1 Reply)
Discussion started by: pathunkathunk
1 Replies

6. Shell Programming and Scripting

awk to print the line that matches and the next if line is wrapped

I have a file and when I match the word "initiators" in the first column I need to be able to print the rest of the columns in that row. This is fine for the most part but on occasion the "initiators" line gets wrapped to the next line. Here is a sample of the file. caw-enabled ... (3 Replies)
Discussion started by: kieranfoley
3 Replies

7. Shell Programming and Scripting

Print entire line only if certain fixed character matches the string

Hi All, I have a file testarun.txt contains the below lines and i want to print the lines if the character positions 7-8 matches 01. 201401011111 201401022222 201402013333 201402024444 201403015555 201403026666 201404017777 201404028888 201405019999 201405020000 I am trying the... (4 Replies)
Discussion started by: Arunprasad
4 Replies

8. Shell Programming and Scripting

How to print line if two lines above it matches patterns.?

Hi, I could only find examples to print line before/after a match, but I'd need to print line after two separate lines matching. E.g.: From the below log entry, I would need to print out the 1234. This is from a huge log file, that has a lot of entries with "CLIENT" and "No" entries (+ other... (3 Replies)
Discussion started by: Juha
3 Replies

9. Linux

Print line 1 if line 3 matches of the output

Hi I want to extend following command so that on the basis of "Branch: ****" on the third line I can grep and print name of the file on the first line. cat .labellog.emd | grep DA2458A7962276A7E040E50A0DC06459 | cut -d " " -f2 | grep -v branch_name | xargs -I file <command to describe> file ... (1 Reply)
Discussion started by: ezee
1 Replies

10. Shell Programming and Scripting

Print line if values in fields matches number and text

datafile: 2017-03-24 10:26:22.098566|5|'No Route for Sndr:RETEK RMS 00040 /ZZ Appl:PF Func:PD Txn:832 Group Cntr:None ISA CntlNr:None Ver:003050 '|'2'|'PFI'|'-'|'EAI_ED_DeleteAll'|'EAI_ED'|NULL|NULL|NULL|139050594|ActivityLog| 2017-03-27 02:50:02.028706|5|'No Route for... (7 Replies)
Discussion started by: SkySmart
7 Replies
SLAGTS(l)								 )								 SLAGTS(l)

NAME
SLAGTS - may be used to solve one of the systems of equations (T - lambda*I)*x = y or (T - lambda*I)'*x = y, SYNOPSIS
SUBROUTINE SLAGTS( JOB, N, A, B, C, D, IN, Y, TOL, INFO ) INTEGER INFO, JOB, N REAL TOL INTEGER IN( * ) REAL A( * ), B( * ), C( * ), D( * ), Y( * ) PURPOSE
SLAGTS may be used to solve one of the systems of equations (T - lambda*I)*x = y or (T - lambda*I)'*x = y, where T is an n by n tridiagonal matrix, for x, following the factorization of (T - lambda*I) as (T - lambda*I) = P*L*U , by routine SLAGTF. The choice of equation to be solved is controlled by the argument JOB, and in each case there is an option to perturb zero or very small diagonal elements of U, this option being intended for use in applications such as inverse iteration. ARGUMENTS
JOB (input) INTEGER Specifies the job to be performed by SLAGTS as follows: = 1: The equations (T - lambda*I)x = y are to be solved, but diagonal elements of U are not to be perturbed. = -1: The equa- tions (T - lambda*I)x = y are to be solved and, if overflow would otherwise occur, the diagonal elements of U are to be per- turbed. See argument TOL below. = 2: The equations (T - lambda*I)'x = y are to be solved, but diagonal elements of U are not to be perturbed. = -2: The equations (T - lambda*I)'x = y are to be solved and, if overflow would otherwise occur, the diagonal elements of U are to be perturbed. See argument TOL below. N (input) INTEGER The order of the matrix T. A (input) REAL array, dimension (N) On entry, A must contain the diagonal elements of U as returned from SLAGTF. B (input) REAL array, dimension (N-1) On entry, B must contain the first super-diagonal elements of U as returned from SLAGTF. C (input) REAL array, dimension (N-1) On entry, C must contain the sub-diagonal elements of L as returned from SLAGTF. D (input) REAL array, dimension (N-2) On entry, D must contain the second super-diagonal elements of U as returned from SLAGTF. IN (input) INTEGER array, dimension (N) On entry, IN must contain details of the matrix P as returned from SLAGTF. Y (input/output) REAL array, dimension (N) On entry, the right hand side vector y. On exit, Y is overwritten by the solution vector x. TOL (input/output) REAL On entry, with JOB .lt. 0, TOL should be the minimum perturbation to be made to very small diagonal elements of U. TOL should normally be chosen as about eps*norm(U), where eps is the relative machine precision, but if TOL is supplied as non-positive, then it is reset to eps*max( abs( u(i,j) ) ). If JOB .gt. 0 then TOL is not referenced. On exit, TOL is changed as described above, only if TOL is non-positive on entry. Otherwise TOL is unchanged. INFO (output) INTEGER = 0 : successful exit element of the solution vector x. This can only occur when JOB is supplied as positive and either means that a diagonal element of U is very small, or that the elements of the right-hand side vector y are very large. LAPACK version 3.0 15 June 2000 SLAGTS(l)
All times are GMT -4. The time now is 09:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy