Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Please help with Linux script to compare file two fields values Post 303044254 by Neo on Monday 17th of February 2020 10:55:21 AM
Old 02-17-2020
This question looks like homework.

Please follow forum rules about homework.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need awk script to compare 2 fields in fixed length file.

Need a script that manipulates a fixed length file that will compare 2 fields in that file and if they are equal write that line to a new file. i.e. If fields 87-93 = fields 119-125, then write the entire line to a new file. Do this for every line in the file. After we get only the fields... (1 Reply)
Discussion started by: Muga801
1 Replies

2. UNIX for Advanced & Expert Users

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Discussion started by: yerruhari
1 Replies

3. UNIX for Dummies Questions & Answers

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Discussion started by: yerruhari
1 Replies

4. Shell Programming and Scripting

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (3 Replies)
Discussion started by: yerruhari
3 Replies

5. Shell Programming and Scripting

Compare two files based on values of fields.

Hi All, I have two files and data looks like this: File1 Contents #Field1,Field2 Dist_Center_file1.txt;21 Dist_Center_file3.txt;20 Dist_Center_file2.txt;20 File2 Contents (*** No Header ***) Dist_Center_file1.txt;23 Dist_Center_file2.txt;20 Dist_Center_file3.txt;20 I have... (4 Replies)
Discussion started by: Hangman2
4 Replies

6. Shell Programming and Scripting

Compare values in two files. For matching rows print corresponding values from File 1 in File2.

- I have two files (File 1 and File 2) and the contents of the files are mentioned below. - I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2. - I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies

7. UNIX for Dummies Questions & Answers

Compare values of fields from same column with awk

Hi all ! If there is only one single value in a column (e.g. column 1 below), then return this value in the same output column. If there are several values in the same column (e.g. column 2 below), then return the different values separated by "," in the output. pipe-separated input: ... (11 Replies)
Discussion started by: lucasvs
11 Replies

8. Shell Programming and Scripting

LINUX - How to compare the values in 2 files & exit from the script

Hi All, I have a requirement where I need to compare 2 files & if the values in the files match, it should proceed, else exit the script without proceeding further. For e.g : Scenario 1 In this case, the script should exit without proceeding further. Scenario 2 In this case, the script... (7 Replies)
Discussion started by: dsfreddie
7 Replies

9. UNIX for Advanced & Expert Users

Script to parse and compare information in two fields of file

Hello, I am working parsing a large input file1(field CFA) I have to compare the the file1 field(CFA byte 88-96) with the content of the file2(It contains only one field) and and insert rows equal in another file. Here is my code and sample input file: ... (7 Replies)
Discussion started by: GERMANOS
7 Replies

10. Programming

Python script to grep fields and use values from file 1 as argument for another command

Hi Experts, I am working one one python script in version 3.x and 2.6. Need your support to complete it Basically for both commands i have telnet to device and run command and then receiving input File 1 and File 2 I have two commands, need to grep data and output in csv file. Next script/code... (0 Replies)
Discussion started by: as7951
0 Replies
Config::Model::Warper(3pm)				User Contributed Perl Documentation				Config::Model::Warper(3pm)

NAME
Config::Model::Warper - Warp tree properties VERSION
version 2.021 SYNOPSIS
# internal class DESCRIPTION
Depending on the value of a warp master (In fact a Config::Model::Value object), this class will change the properties of a node (Config::Model::WarpedNode), a hash (Config::Model::HashId), a list (Config::Model::ListId), a checklist (Config::Model::CheckList) or another value. Warper and warped Warping an object means that the properties of the object will be changed depending on the value of another object. The changed object is referred as the warped object. The other object that holds the important value is referred as the warp master or the warper object. You can also set up several warp master for one warped object. This means that the properties of the warped object will be changed according to a combination of values of the warp masters. Warp arguments Warp arguments are passed in a hash ref whose keys are "follow" and and "rules": Warp follow argument Grab string leading to the "Config::Model::Value" warp master. E.g.: follow => '! tree_macro' In case of several warp master, "follow" will be set to an array ref of several grab string: follow => [ '! macro1', '- macro2' ] You can also use named parameters: follow => { m1 => '! macro1', m2 => '- macro2' } Warp rules argument String, hash ref or array ref that specify the warped object property changes. These rules specifies the actual property changes for the warped object depending on the value(s) of the warp master(s). E.g. for a simple case (rules is a hash ref) : follow => '! macro1' , rules => { A => { <effect for macro1 == A> }, B => { <effect for macro1 == B> } } In case of similar effects, you can use named parameters and a boolean expression to specify the effect. The first match will be applied. In this case, rules is a list ref: follow => { m => '! macro1' } , rules => [ '$m eq "A"' => { <effect for macro1 == A> }, '$m eq "B" or $m eq"C "' => { <effect for macro1 == B|C > } ] In case of several warp masters, "follow" must use named parameters, and rules must use boolean expression: follow => { m1 => '! macro1', m2 => '- macro2' } , rules => [ '$m1 eq "A" && $m2 eq "C"' => { <effect for A C> }, '$m1 eq "A" && $m2 eq "D"' => { <effect for A D> }, '$m1 eq "B" && $m2 eq "C"' => { <effect for B C> }, '$m1 eq "B" && $m2 eq "D"' => { <effect for B D> }, ] Of course some combinations of warp master values can have the same effect: follow => { m1 => '! macro1', m2 => '- macro2' } , rules => [ '$m1 eq "A" && $m2 eq "C"' => { <effect X> }, '$m1 eq "A" && $m2 eq "D"' => { <effect Y> }, '$m1 eq "B" && $m2 eq "C"' => { <effect Y> }, '$m1 eq "B" && $m2 eq "D"' => { <effect Y> }, ] In this case, you can use different boolean expression to save typing: follow => { m1 => '! macro1', m2 => '- macro2' } , rules => [ '$m1 eq "A" && $m2 eq "C"' => { <effect X> }, '$m1 eq "A" && $m2 eq "D"' => { <effect Y> }, '$m1 eq "B" && ( $m2 eq "C" or $m2 eq "D") ' => { <effect Y> }, ] Note that the boolean expression will be sanitized and used in a Perl eval, so you can use most Perl syntax and regular expressions. Function (like &foo) will be called like "$self->foo" before evaluation of the boolean expression. Methods warp_error() This method returns a string describing: o The location(s) of the warp master o The current value(s) of the warp master(s) o The other values accepted by the warp master that can be tried (if the warp master is an enumerated type) How does this work ? Registration o When a warped object is created, the constructor will register to the warp masters. The warp master are found by using the special string passed to the "follow" parameter. As explained in grab method, the string provides the location of the warp master in the configuration tree using a symbolic form. o Then the warped object retrieve the value(s) of the warp master(s) o Then the warped object warps itself using the above value(s). Depending on these value(s), the properties of the warped object will be modified. Master update o When a warp master value is updated, the warp master will call all its warped object and pass them the new master value. o Then each warped object will modify its properties according to the new warp master value. AUTHOR
Dominique Dumont, (ddumont at cpan dot org) SEE ALSO
Config::Model::AnyThing, Config::Model::HashId, Config::Model::ListId, Config::Model::WarpedNode, Config::Model::Value perl v5.14.2 2012-11-09 Config::Model::Warper(3pm)
All times are GMT -4. The time now is 04:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy