Sponsored Content
Top Forums Shell Programming and Scripting Compare field and get the missing in Linux shell. Post 302732081 by sabercats on Friday 16th of November 2012 02:08:19 PM
Old 11-16-2012
Compare field and get the missing in Linux shell.

I have a log file A.txt
Code:
2012/11/13 20:06:11 |t112|Locations 12, 13, 14, 15|NET12/full_ddr3_2X_FV_4BD_1.qt|norway|0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15|norway22
2012/11/14 14:23:19 |t112|Locations 0, 1, 2, 3, 4, 5, 6, 7|NET24/full_111_ddr5_soq523_2X_FV.qt|norway|0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15|norway10
2012/11/14 14:23:19 |a108|Locations 0, 1|NET24/full_111_ddr5_soq523_2X_FV.qt|germany|0,1,2,3|germany10
2012/11/14 16:23:19 |a108|Locations 0, 1,2,3|NET24/full_111_ddr5_soq523_2X_FV.qt|holland|0,1,2,3|holland10

How we do i get the result out put
Code:
2012/11/13 20:06:11 |t112|Locations 12, 13, 14, 15|NET12/full_ddr3_2X_FV_4BD_1.qt|norway|0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15|norway22
2012/11/14 14:23:19 |t112|Locations 0, 1, 2, 3, 4, 5, 6, 7|NET24/full_111_ddr5_soq523_2X_FV.qt|norway|0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15|norway10
Currenttime|Available|Locations 8,9,10,11|Available|norway|0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15|norway18 
** norway18 is 10+8 from locations 8 is available, this line not in out put **
2012/11/14 14:23:19 |a108|Locations 0, 1|NET24/full_111_ddr5_soq523_2X_FV.qt|germany|0,1,2,3|germany10
Currenttime|Available|Locations 2,3|Available|germany|0,1,2,3|germany12 
** germany12 is 10+2 from locations 2 is available,  this line not in out put **
2012/11/14 16:23:19 |a108|Locations 0, 1,2,3|NET24/full_111_ddr5_soq523_2X_FV.qt|holland|0,1,2,3|holland10

*** holand have locations 0,1,2,3 matched so it do nothing.
How you use compare field 3 Location with field #6 to find missing location in ksh script? Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

deleting records with a missing field

I had to delete rows when a record was missing a field. My solution was cut -c 202-402 ${dataFile} | awk '{if (substr($0,103,30) !~ /^ *$/) print $0} >> ${workFile} The cut is because they came two records to a row. Anyone want to offer a more elegant solution? (2 Replies)
Discussion started by: gillbates
2 Replies

2. Shell Programming and Scripting

Compare files in two folders and delete missing ones

I do not know much about shell scripting so I am at a loss here. If someone can help me, that would be great! I have two directories /dir1 /dir2 I need to delete all files from /dir1 and that does not have a correspondent file in /dir2. It should NOT check file suffixes in /dir2 . Why?... (20 Replies)
Discussion started by: kaah
20 Replies

3. Shell Programming and Scripting

AWK: Pattern match between 2 files, then compare a field in file1 as > or < field in file2

First, thanks for the help in previous posts... couldn't have gotten where I am now without it! So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following: If $1... (4 Replies)
Discussion started by: right_coaster
4 Replies

4. Shell Programming and Scripting

Insert missing field using perl,sed,awk

sample file (comma as field separators) MessageFlow,1,BusIntBatchMgr,a OOBEvent,1,BusIntBatchMgr,a TaskEvents,1,,a MTTrace,1,,a MTWarning,,1,a MessageFlow,1,Batch,a OOBEvent,1,Batch,a TaskEvents,1,,a EAISAPIdocWizard,1,BusIntMgr,a EAISAPBAPIWizard,1,BusIntMgr,a... (3 Replies)
Discussion started by: vrclm
3 Replies

5. Shell Programming and Scripting

Compare Field in Current Line with Field in Previous

Hi Guys I have the following file Essentially, I am trying to find the right awk/sed syntax in order to produce the following 3 distinct files from the file above: Basically, I want to print the lines of the file as long as the second field of the current line is equal to the... (9 Replies)
Discussion started by: moutaye
9 Replies

6. Shell Programming and Scripting

Compare two files Field by field and output the result in another file

Hi Friends, Need Help. I have file1.txt as File1.txt |123|A|7267|Hyder|Cross|Sell|7801 |995|A|7051|2008|Lunar|New|Year|Promotion|7801 |996|A|7022|Q108|Targ|Prospect|&|SSCC|Savings|Promo|7801 |997|A|7182|Q1|Feb-Apr|08|Credit|ITA|PA|SBA|Campaign|7801 File2.txt... (7 Replies)
Discussion started by: i150371485
7 Replies

7. Shell Programming and Scripting

Plz Help. Compare 2 files field by field and get the output in another file.

Hi Freinds, I have 2 files . one is source.txt and second one is target.txt. I want to keep source.txt as baseline and compare target.txt. please find the data in 2 files and Expected output. Source.txt 1|HYD|NAG|TRA|34.5|1234 2|CHE|ESW|DES|36.5|134 3|BAN|MEH|TRA|33.5|234... (5 Replies)
Discussion started by: i150371485
5 Replies

8. Shell Programming and Scripting

Linux Script to compare two folders and copy missing files

Hi, I need help in shell scripting. If someone can help me, that would be great! Problem. I want Linux Script to compare two folders and copy missing files. Description. I have two directories /dir1 /dir2 I need to copy all distinct/new/unique/missing files from /dir1 and that... (1 Reply)
Discussion started by: S.Praveen Kumar
1 Replies

9. Shell Programming and Scripting

Compare two files and get only missing names

I need to compare two files (oldfile1 & newfile). Need to ignore the values which are present in both files. At the same time, i need to get only records in new file. Tried using Join -v1 -v2 oldfile1 newfile (suspect it has not worked as expected). could anyone of you please help me here. (5 Replies)
Discussion started by: Selva_2507
5 Replies

10. UNIX for Beginners Questions & Answers

Linux/Shell script - How to compare 2 arrays based on patterns and get the differences

I have FILE 1 (This file has all master columns/headers) A|B|C|D|E|F|G|H|STATUS FILE 2 A|C|F|I|OFF_STATUS 3|4|5|4|Y 6|7|8|5|Y Below command give me all headers of FILE 2 into array2.txt file paste <(head -1 FILE2.txt | tr '|' '\n')>array2.txt So I would like to compare... (2 Replies)
Discussion started by: jmadhams
2 Replies
CPANPLUS::Configure(3pm)				 Perl Programmers Reference Guide				  CPANPLUS::Configure(3pm)

NAME
CPANPLUS::Configure - configuration for CPANPLUS SYNOPSIS
$conf = CPANPLUS::Configure->new( ); $bool = $conf->can_save; $bool = $conf->save( $where ); @opts = $conf->options( $type ); $make = $conf->get_program('make'); $verbose = $conf->set_conf( verbose => 1 ); DESCRIPTION
This module deals with all the configuration issues for CPANPLUS. Users can use objects created by this module to alter the behaviour of CPANPLUS. Please refer to the "CPANPLUS::Backend" documentation on how to obtain a "CPANPLUS::Configure" object. METHODS
$Configure = CPANPLUS::Configure->new( load_configs => BOOL ) This method returns a new object. Normal users will never need to invoke the "new" method, but instead retrieve the desired object via a method call on a "CPANPLUS::Backend" object. load_configs Controls whether or not additional user configurations are to be loaded or not. Defaults to "true". $bool = $Configure->init( [rescan => BOOL]) Initialize the configure with other config files than just the default 'CPANPLUS::Config'. Called from "new()" to load user/system configurations If the "rescan" option is provided, your disk will be examined again to see if there are new config files that could be read. Defaults to "false". Returns true on success, false on failure. can_save( [$config_location] ) Check if we can save the configuration to the specified file. If no file is provided, defaults to your personal config. Returns true if the file can be saved, false otherwise. $file = $conf->save( [$package_name] ) Saves the configuration to the package name you provided. If this package is not "CPANPLUS::Config::System", it will be saved in your ".cpanplus" directory, otherwise it will be attempted to be saved in the system wide directory. If no argument is provided, it will default to your personal config. Returns the full path to the file if the config was saved, false otherwise. options( type => TYPE ) Returns a list of all valid config options given a specific type (like for example "conf" of "program") or false if the type does not exist ACCESSORS
Accessors that start with a "_" are marked private -- regular users should never need to use these. See the "CPANPLUS::Config" documentation for what items can be set and retrieved. get_SOMETHING( ITEM, [ITEM, ITEM, ... ] ); The "get_*" style accessors merely retrieves one or more desired config options. set_SOMETHING( ITEM => VAL, [ITEM => VAL, ITEM => VAL, ... ] ); The "set_*" style accessors set the current value for one or more config options and will return true upon success, false on failure. add_SOMETHING( ITEM => VAL, [ITEM => VAL, ITEM => VAL, ... ] ); The "add_*" style accessor adds a new key to a config key. Currently, the following accessors exist: set|get_conf Simple configuration directives like verbosity and favourite shell. set|get_program Location of helper programs. _set|_get_build Locations of where to put what files for CPANPLUS. _set|_get_source Locations and names of source files locally. _set|_get_mirror Locations and names of source files remotely. _set|_get_fetch Special settings pertaining to the fetching of files. BUG REPORTS
Please report bugs or other issues to <bug-cpanplus@rt.cpan.org<gt>. AUTHOR
This module by Jos Boumans <kane@cpan.org>. COPYRIGHT
The CPAN++ interface (of which this module is a part of) is copyright (c) 2001 - 2007, Jos Boumans <kane@cpan.org>. All rights reserved. This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. SEE ALSO
CPANPLUS::Backend, CPANPLUS::Configure::Setup, CPANPLUS::Config perl v5.18.2 2014-01-06 CPANPLUS::Configure(3pm)
All times are GMT -4. The time now is 02:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy