Sponsored Content
Top Forums Shell Programming and Scripting Print only lines where fields concatenated match strings Post 302757737 by Ophiuchus on Friday 18th of January 2013 01:32:56 AM
Old 01-18-2013
Print only lines where fields concatenated match strings

Hello everyone,

Maybe somebody could help me with an awk script.

I have this input (field separator is comma ","):
Code:
547894982,M|N|J,U|Q|P,98,101,0,1,1
234900027,M|N|J,U|Q|P,98,101,0,1,1
234900023,M|N|J,U|Q|P,98,54,3,1,1
234900028,M|H|J,S|Q|P,98,101,0,1,1
234900030,M|N|J,U|F|P,98,101,0,1,1
547894932,M|H|J,U|Q|P,98,101,0,1,1
547894900,M|N|J,U|Q|P,98,101,0,1,1
547894995,M|T|J,U|Q|P,98,101,0,1,1
547894977,M|N|J,U|Q|P,0,101,0,1,1
300888261,R|N|J,U|Q|P,98,101,0,1,1

If the resulting string of concatenate fields from field2 to last field is different to the following strings:
M|N|JU|Q|P98101011
M|H|JU|Q|P98101011
M|H|JS|Q|P98101011

Then print those lines, so the output should be:
Code:
234900023,M|N|J,U|Q|P,98,54,3,1,1,Different
234900030,M|N|J,U|F|P,98,101,0,1,1,Different
547894995,M|T|J,U|Q|P,98,101,0,1,1,Different
547894977,M|N|J,U|Q|P,0,101,0,1,1,Different
300888261,R|N|J,U|Q|P,98,101,0,1,1,Different

I hope the explanation is good enough.

Thanks in advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Strings from one file which exactly match to the 1st column of other file and then print lines.

Hi, I have two files. 1st file has 1 column (huge file containing ~19200000 lines) and 2nd file has 2 columns (small file containing ~6000 lines). ################################# huge_file.txt a a ab b ################################## small_file.txt a 1.5 b 2.5 ab ... (4 Replies)
Discussion started by: AshwaniSharma09
4 Replies

2. Shell Programming and Scripting

Splitting Concatenated Words With Largest Strings First

hello, I had posted earlier help for a script for splitting concatenated words . The script was supposed to read words from a master file and split concatenated words in the slave/input file. Thanks to the help I got, the following script which works very well was posted. It detects residues by... (14 Replies)
Discussion started by: gimley
14 Replies

3. Shell Programming and Scripting

awk strings search + print next column after match

Hi, I have a file filled with search strings which have a blank in between and look like this: S. g. Ehr. o. Jg. v. d. Chijs g. Ehr. Now i would like to search for the strings and it also shall return the next column after the match. awk -v FILE="search_strings.txt" 'BEGIN {... (10 Replies)
Discussion started by: sdf
10 Replies

4. Shell Programming and Scripting

Print strings that match pattern with awk

I have a file with many lines which contain strings like .. etc. But with no rule regarding field separators or anything else. I want to print ONLY THE STRING from each line , not the entire line !!! For example from the lines : Flow on service executed with success in . Performances... (5 Replies)
Discussion started by: black_fender
5 Replies

5. Shell Programming and Scripting

Returning two lines if they both match strings

Hi I have a problem where I have a large amount of files that I need to scan and return a line and its following line, but only when the following line begins with a string. String one - line one must begin with 'Bill' String two - line two must begin with 'Jones'. If these two... (7 Replies)
Discussion started by: majormajormajor
7 Replies

6. UNIX for Dummies Questions & Answers

awk - (URGENT!) Print lines sort and move lines if match found

URGENT HELP IS NEEDED!! I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but - Currently, script is not printing lines to File3.txt in order. - Also the matching lines are not moving out of File1.txt ... (1 Reply)
Discussion started by: High-T
1 Replies

7. Shell Programming and Scripting

Match the value & print lines from the match

Hello, I have a file contains two columns. I need to print the lines after “xxx” so i'm trying to match "xxx" & cut the lines after that. I'm trying with the grep & cut command, if there any simple way to extract this please help me. Sample file : name id AAA 123 AAB 124 AAC 125... (4 Replies)
Discussion started by: Shenbaga.d
4 Replies

8. Shell Programming and Scripting

awk to print fields that match using conditions and a default value for non-matching in two files

Trying to use awk to match the contents of each line in file1 with $5 in file2. Both files are tab-delimited and there may be a space or special character in the name being matched in file2, for example in file1 the name is BRCA1 but in file2 the name is BRCA 1 or in file1 name is BCR but in file2... (6 Replies)
Discussion started by: cmccabe
6 Replies

9. Shell Programming and Scripting

awk to combine lines if fields match in lines

In the awk below, what I am attempting to do is check each line in the tab-delimeted input, which has ~20 lines in it, for a keyword SVTYPE=Fusion. If the keyword is found I am splitting $3 using the . (dot) and reading the portion before and after the dot in an array a. If it does have that... (12 Replies)
Discussion started by: cmccabe
12 Replies

10. Shell Programming and Scripting

awk to print match or non-match and select fields/patterns for non-matches

In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies
FCOEADM(8)							  Open-FCoE Tools							FCOEADM(8)

NAME
fcoeadm - The Open-FCoE Administration Tool SYNOPSIS
fcoeadm -c|--create ethX fcoeadm -d|--destroy ethX fcoeadm -r|--reset ethX fcoeadm -i|--interface [ethX] fcoeadm -S|--Scan [ethX] fcoeadm -t|--target [ethX] fcoeadm -l|--lun [ethX] fcoeadm -s|--stats ethX [interval] fcoeadm -h|--help fcoeadm -v|--version DESCRIPTION
The fcoeadm utility is the Fibre Channel over Ethernet (FCoE) management tool for the Open-FCoE project. fcoeadm may be used to create, destroy, and reset an FCoE instance on a given network interface. For these operations fcoeadm sends a command to a running fcoemon process, via a socket interface. fcoemon will then perform the requested operation. fcoeadm also provides options to query information about FCoE instances, including interface information, target information, LUN information, and port statistics. For much of this information, fcoeadm relies on the libhbalinux implementation of the HBA API. OPTIONS
-c, --create ethX Creates an FCoE instance based on the specified network interface. Note that if there is not an fcoemon configuration file for the interface (/etc/fcoe/cfg-ethX, see fcoemon), then the created FCoE instance will not require DCB. -d, --destroy ethX Destroys the FCoE instance on the specified network interface. This will not destroy FCoE instances created by fipvlan. -r, --reset ethX Resets the FCoE instance on the specified network interface. This will not reset FCoE instances created by fipvlan. -i, --interface [ethX] Show information about the FCoE instance on the specified network interface, or all FCoE instances if no network interface is specified. -S, --Scan ethX Rescan for new targets and LUNs on the provided instance. This command will not rescan any NPIV instances created on the same port. This will not rescan any FCoE instance created by fipvlan. -t, --target [ethX] Show information about the discovered targets associated with the FCoE instance on the specified network interface. If no network interface is specified, information about discovered targets from all FCoE instances will be shown. -l, --lun [ethX] Show detailed information about the discovered SCSI LUNs associated with the FCoE instance on the specified network interface. If no network interface is specified, information about SCSI LUNs from all FCoE instances will be shown. -s, --stats ethX [interval] Show the statistics (including FC4 statistics) of the FCoE interface on the specified network interface. The information will be display in one line on the screen per given time interval. interval should be specified in whole integers greater than 0. It specifies the time interval in the unit of seconds. If interval is not specified, the default interval is one second. -h, --help Displays the usage message of the fcoeadm command. -v, --version Displays the version of the fcoeadm command. EXAMPLES
Creates an FCoE instance on eth2.101 fcoeadm -c eth2.101 Destroys the FCoE instance on eth2.101 fcoeadm -d eth2.101 Resets the FCoE instance on eth2.101 fcoeadm -r eth2.101 Show the information of all the adapters and their ports having FCoE instances created fcoeadm -i Show the information of all FCoE instances on interface eth3. fcoeadm -i eth3 Show the information of all the discovered targets from all the ports having FCoE instances created (they may be on different adapter cards). A brief listing of discovered LUNs are listed after the target they are associated with, if any fcoeadm -t Show the information of all the discovered targets from a given port (eth3) having FCoE instance created. A brief listing of discovered LUNs are listed after each target they are associated with, if any fcoeadm -t eth3 Show the detailed information of all the LUNs discovered on all FCoE connections fcoeadm -l Show the detailed information of all the LUNs associated with a specific interface fcoeadm -l eth3.101 Show the statistics information of a specific port eth3 having FCoE instances created. The statistics are displayed one line per time interval. The default interval is one second if an interval is not specified fcoeadm -s eth3 fcoeadm -s eth3 3 SEE ALSO
fcoemon(8) SUPPORT
fcoeadm is part of the fcoe-utils package, maintained through the Open-FCoE project. Resources for both developers and users can be found at the Open-FCoE website http://open-fcoe.org/ Open-FCoE 10/18/2011 FCOEADM(8)
All times are GMT -4. The time now is 06:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy