Sponsored Content
Top Forums Shell Programming and Scripting Threshold is less than 0.003 or equal then print the line Post 302338681 by ppat7046 on Tuesday 28th of July 2009 04:03:21 PM
Old 07-28-2009
Threshold is less than 0.003 or equal then print the line

Friends,

I have very large data files (File1 and File2).
Search field1 of File1 into Field1 of File2.
If found then do Field1 of File1 MINUS Field1 of File2
if the answer is <= 0.003 (positive or negative) then
print that line from File1.


File1
ABC1231|1.1111|2.2122|3.3133
ABC1232|1.1211|2.2222|3.3233
ABC1233|1.1311|2.2322|3.3333

File2
ABC1231|1.1111|2.2122|3.3133
ABC1232|1.1211|2.2222|3.3233
ABC1233|1.1311|2.2322|3.3333
ABC1234|1.1411|2.2422|3.3433
ABC1235|1.1511|2.2522|3.3533


Thanks,
Prashant
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare multiple fields in file1 to file2 and print line and next line

Hello, I have two files that I need to compare and print out the line from file2 that has the first 6 fields matching the first 6 fields in file1. Complicating this are the following restrictions 1. file1 is only a few thousand lines at most and file2 is greater than 2 million 2. I need to... (7 Replies)
Discussion started by: gillesc_mac
7 Replies

2. Programming

Catch signal SIGPIPE print errno but it's value equal to 2

catch signal SIGPIPE ,print errno but it's value equal to 2(ENOENT) #define ENOENT 2 /* No such file or directory */ is it should be EPIPE ? #define EPIPE 32 /* Broken pipe */ Thanks ! (7 Replies)
Discussion started by: aobai
7 Replies

3. Shell Programming and Scripting

Print pipe separated list as line by line in Korn Shell

Korn Shell in AIX 6.1 I want to print the below shown pipe (|) separated list line by line. line=es349889|nhb882309|ts00293|snh03524|bg578835|bg37900|rnh00297|py882201|sg175883 for i in line do echo "Hello $line " done I wanted to execute the above for loop. But i can't even set the... (3 Replies)
Discussion started by: polavan
3 Replies

4. Shell Programming and Scripting

Using awk, print all the lines where field 8 is equal to x

Using awk, print all the lines where field 8 is equal to x I really did try, but this awk thing is really hard to figure out. file1.txt"Georgia","Atlanta","2011-11-02","x","","","","" "California","Los Angeles","2011-11-03","x","","","",""... (2 Replies)
Discussion started by: charles33
2 Replies

5. Shell Programming and Scripting

awk to print record not equal specific pattern

how to use "awk" to print any record has pattern not equal ? for example my file has 5 records & I need to get all lines which $1=10 or 20 , $2=10 or 20 and $3 greater than "130302" as it shown : 10 20 1303252348212B030 20 10 1303242348212B030 40 34 1303252348212B030 10 20 ... (14 Replies)
Discussion started by: arm
14 Replies

6. Shell Programming and Scripting

If first character doesn't equal '#' and same line contains 'temp', print everything else

(2 Replies)
Discussion started by: snoman1
2 Replies

7. Shell Programming and Scripting

sed - How to replace right part of equal sign (=) on a line

Hello. Using a bash script , I have a variable name for the file I want to modify FILE_TO_EDIT="/etc/my_config_file"And I have a variable name for the parameter to change PARAMETER="fallback_node" PARAMETER_NEW_VALUE="http://my_server_name.com/new_path" A config file may contain : 1°)... (2 Replies)
Discussion started by: jcdole
2 Replies

8. Shell Programming and Scripting

Find line then evaluate text on next line, print when condition is met

Hello, I am looking for a specific situation in a text file. The conditions are, > <CompoundName> InChI=1S/C5H12NO2/c1-5(2)4-8-6(3)7/h5H,4H2,1-3H3/q+1 I am looking for cases where the line "> <CompoundName>" is followed by a line that contains the string "InChI=" without regard to... (5 Replies)
Discussion started by: LMHmedchem
5 Replies

9. UNIX for Beginners Questions & Answers

Reading a file line by line and print required lines based on pattern

Hi All, i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field. i am using centos 7 Operating system. want to read below file. # cat /tmp/d5 NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies

10. Shell Programming and Scripting

How to print out with equal spacing between columns?

For instance, my file contains the following content... set -A array set -A test ${array}=1 ${array}=2 ${array}=3 ${test}="Boy" ${test}="Girl" ${test}="Dog" x=0 while ;do print "${array}" " " "${test}" x=$((x+1) done... (1 Reply)
Discussion started by: TestKing
1 Replies
SVN::Web::DiffParser(3pm)				User Contributed Perl Documentation				 SVN::Web::DiffParser(3pm)

NAME
SVN::Web::DiffParser - Parse patch files containing unified and standard diffs NOTE
This is Text::Diff::Parser, plus some local bug fixes that were exposed by use with SVN::Web. For more details about Text::Diff::Parser please see CPAN. SYNOPSIS
use SVN::Web::DiffParser; # create the object my $parser = SVN::Web::DiffParser->new(); # With options $parser = SVN::Web::DiffParser->new( Simplify=>1, # simplify the diff Strip=>2 ); # strip 2 directories # Create object. Parse $file $parser = SVN::Web::DiffParser->new( $file ); $parser = SVN::Web::DiffParser->new( File=>$file ); # Create object. Parse text my $parser = SVN::Web::DiffParser->new( $text ); $parser = SVN::Web::DiffParser->new( Diff=>$text ); # parse a file $parser->parse_file( $filename ); # parse a string $parser->parse( $text ); # Remove no-change lines. Combine line substitutions $parser->simplify; # Find results foreach my $change ( $parser->changes ) { print "File1: ", $change->filename1; print "Line1: ", $change->line1; print "File2: ", $change->filename2; print "Line2: ", $change->line2; print "Type: ", $change->type; my $size = $change->size; foreach my $line ( 0..($size-1) ) { print "Line: ", $change->line( $size ); } } # In scalar context, returns the number of changes my $n = $parser->changes; print "There are $n changes", # Get the changes to a given file my @changes = $parser->changes( 'Makefile.PL' ); # Get list of files changed by the diff my @files = $parser->files; DESCRIPTION
"SVN::Web::DiffParser" parses diff files and patches. It allows you to access the changes to a file in a standardized way, even if multiple patch formats are used. A diff may be viewed a series of operations on a file, either adding, removing or modifying lines of one file (the "from-file") to produce another file (the "to-file"). Diffs are generally produced either by hand with diff, or by your version control system ("cvs diff", "svn diff", ...). Some diff formats, notably unified diffs, also contain null operations, that is lines that "SVN::Web::DiffParser" currently parses unified diff format and standard diff format. Unified diffs look like the following. --- Filename1 2006-04-12 18:47:22.000000000 -0400 +++ Filename2 2006-04-12 19:21:16.000000000 -0400 @@ -1,4 +1,6 @@ ONE TWO -THREE +honk FOUR +honk +honk Standard diffs look like the following. diff something something.4 3c3 < THREE --- > honk 4a5,6 > honk > honk The diff line isn't in fact part of the format but is necessary to find which files the chunks deal with. It is output by "cvs diff" and "svn diff" so that isn't a problem. METHODS
new $parser = SVN::Web::DiffParser->new; $parser = SVN::Web::DiffParser->new( $file ); $parser = SVN::Web::DiffParser->new( $handle ); $parser = SVN::Web::DiffParser->new( %params ); $parser = SVN::Web::DiffParser->new( \%params ); Object constructor. Diff String that contains a diff. This diff will be parse before "new" returns. File File name or file handle that is parsed before "new" returns. Simplify Simplifying a patch involves dropping all null-operations and converting and remove operation followed by an add operation (or an add followed by a remove) of the same size on the same lines into a modify operation. Strip Strip N leading directories from all filenames. Less then useful for standard diffs produced by "cvs diff", because they don't contain directory information. Verbose If true, print copious details of what is going on. parse_file $parser->parse_file( $file ); $parser->parse_file( $handle ); Read and parse the file or file handle specified. Will "die" if it fails, returns true on success. Contents of the file may then be accessed with "changes" and "files". parse $parser->parse( $string ); Parses the diff present in $string. Will "die" if it fails, returns true on success. Contents of the file may then be accessed with "changes" and "files". files %files = $parser->files; Fetch a list of all the files that were referenced in the patch. The keys are original files ("from-file") and the values are the modified files ("to-file"). changes @changes = $parser->changes; $n = $parser->changes; @changes = $parser->changes( $file ); $n = $parser->changes( $file ); Return all the operations (array context) or the number of operations in the patch file. If $file is specified, only returns changes to that file ("from-file" or "to-file"). Elements of the returned array are change objects, as described in "CHANGE METHODS" below. CHANGE METHODS
The "changes" method returns an array of objects that describe each operation. You may use the following methods to find out details of the operation. type Returns the type of operation, either 'ADD', 'REMOVE', 'MODIFY' or '' (null operation). filename1 Filename of the "from-file". filename2 Filename of the "to-file". line1 Line in the "from-file" the operation starts at. line2 Line in the "to-file" the operation starts at. size Number of lines affected by this operation. text @lines = $ch->text; $line = $ch->text( $N ); Fetch the text of the line $N if present or all lines of affected by this operation. For '' (null) and 'REMOVE' operations, these are the lines present before the operation was done ('from-file'. For 'ADD' and 'MODIFY' operations, these are the lines present after the operation was done ('to-file'. BUGS
I'm not 100% sure of standard diff handling. Missing support for context diffs. SEE ALSO
Text::Diff, Arch, diff. AUTHOR
Philip Gwyn, <gwyn-at-cpan.org> COPYRIGHT AND LICENSE
Copyright (C) 2006 by Philip Gwyn This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. perl v5.14.2 2012-06-11 SVN::Web::DiffParser(3pm)
All times are GMT -4. The time now is 06:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy