Sponsored Content
Full Discussion: To find and compare the data
Top Forums Shell Programming and Scripting To find and compare the data Post 302824689 by Shenbaga.d on Friday 21st of June 2013 10:20:53 AM
Old 06-21-2013
To find and compare the data

hi ,

from the awk command i'm getting the output where the 2nd column of both are match in row wise,
if it present in that same column some where else, I cannot get the correct output.
awk 'FNR==NR {a[$1]=$5;next} $1 in a {if ($5==a[$1]) t=0; else {t=$5-a[$1]};print $0,t}' file.tsv file2.tsv

please check the thread https://www.unix.com/shell-programmin...ent-files.html

---------- Post updated at 07:50 PM ---------- Previous update was at 07:40 PM ----------

Code:
col1 col2 col3
11 15465 13.60
12 24656 11.00
13 245896 754.00

Code:
col1 col2 col3
11 245896 754.00
12 15465 13.60
13 24656 11.00

this will give the wrong output
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

compare data

Hi, my problem is, I have to files, one is a log file of an actual execution, the other file is a pattern file. The entries "abcd,,!!11.22!!,3asdf" and "abcd,,!!xx.xx!!,3asdf" should be identified as equal. At the position of the x in the pattern file, the log file must have... (3 Replies)
Discussion started by: bensky
3 Replies

2. Shell Programming and Scripting

Compare data files

I would like to compare a data file (before and after a process has run) to identify if there are any differences. Can anyone help !! (1 Reply)
Discussion started by: ithomp
1 Replies

3. UNIX for Dummies Questions & Answers

Compare Data in the same file

Dear Unix-Gurus, I'm trying to write a script to compare the data in a log file. Here's how my logfile will look like: 'List All A0 Data in Destination Server' A0567 A0678 A0789 List A0 Files in Source Server A0567 A0678 A0789 So if the file match in Source Server match Destination... (1 Reply)
Discussion started by: lweegp
1 Replies

4. Shell Programming and Scripting

[urgent need help]compare data

hi all, very need help urgently :( i have a problem compare 2 files from solaris, the 2 files its shown below: data1.log : 6512345678 6512345677 20070131 073824 420 6511111111 6522222222 20070131 103747 87 6522222222 6233333333 ... (2 Replies)
Discussion started by: bucci
2 Replies

5. Shell Programming and Scripting

Get data from 3 differrnt oracle DB & then compare data

Hi All, I have a requirement to write a shell script for the following... we have 3 different database.... lets say A, B, C From these 3 DBs, i need to get data.. all have 3 different table...a,b, c A.a => Emp_code, count(*) B.b => emp_code, count(*) C.c => emp_code, copunt(*) Once get this... (4 Replies)
Discussion started by: Amit.Sagpariya
4 Replies

6. Shell Programming and Scripting

Compare 2 files and match column data and align data from 3 column

Hello experts, Please help me in achieving this in an easier way possible. I have 2 csv files with following data: File1 08/23/2012 12:35:47,JOB_5330 08/23/2012 12:35:47,JOB_5330 08/23/2012 12:36:09,JOB_5340 08/23/2012 12:36:14,JOB_5340 08/23/2012 12:36:22,JOB_5350 08/23/2012... (5 Replies)
Discussion started by: asnandhakumar
5 Replies

7. Shell Programming and Scripting

Compare data in two files

Gents, Can you help please I have a data base with lot information (file2) and I have some data in (file1) to compare. Then the comparison should be done using the following keys: Example ( values from file1 ) key1 = columns from 20-34 substr($0,20,15) 66705.00 19793 key2 = columns... (5 Replies)
Discussion started by: jiam912
5 Replies

8. UNIX for Dummies Questions & Answers

Compare data - Match first column and compare second

Hi guys, looking for some help with a way to compare data in two files but with some conditions. example, File 1 consists of site1,10.1.1.1 site2,20.2.2.2 site3,30.3.3.3 File 2 contains site1,l0.1.1.1 site2,50.1.1.1 site3,30.3.3.3 site4,40.1.1.1 I want to be able to match the... (1 Reply)
Discussion started by: mutley2202
1 Replies

9. Shell Programming and Scripting

Compare data with reference from other file

Gents, Please can you help with this. I have a big file (file2) which contends many records increment every 25 rows ( column 1 ). Then I have other file as reference (file1).. column 1 to 11. I want to compare that all values in file2 (column 2 to 12.) match with values in... (2 Replies)
Discussion started by: jiam912
2 Replies

10. Shell Programming and Scripting

Compare data with while if else loop ?!

Good midday and hello to everyone! =) If I describe some things wrong please be aware, that english is not my native language!! :D I'm a bit stuck with a script I need to finish. Due to data protection I need to hide some paths but that should be no problem. My script connects to a db2... (1 Reply)
Discussion started by: dsondermann
1 Replies
LaTeX::Encode(3pm)					User Contributed Perl Documentation					LaTeX::Encode(3pm)

NAME
LaTeX::Encode - encode characters for LaTeX formatting SYNOPSIS
use LaTeX::Encode; $latex = latex_encode($text, %options); VERSION
This manual page describes version 0.03 of the "LaTeX::Encode" module. DESCRIPTION
This module provides a function to encode text that is to be formatted with LaTeX. It encodes characters that are special to LaTeX or that are represented in LaTeX by LaTeX commands. The special characters are: "" (command character), "{" (open group), "}" (end group), "&" (table column separator), "#" (parameter specifier), "%" (comment character), "_" (subscript), "^" (superscript), "~" (non-breakable space), "$" (mathematics mode). Note that some of the LaTeX commands for characters are defined in the LaTeX "textcomp" package. If your text includes such characters, you will need to include the following lines in the preamble to your LaTeX document. usepackage[T1]{fontenc} usepackage{textcomp} The function is useful for encoding data that is interpolated into LaTeX document templates, say with "Template::Plugin::Latex" (shameless plug!). SUBROUTINES
/METHODS "latex_encode($text, %options)" Encodes the specified text such that it is suitable for processing with LaTeX. The behaviour of the filter is modified by the options: "except" Lists the characters that should be excluded from encoding. By default no special characters are excluded, but it may be useful to specify "except = "\{}"" to allow the input string to contain LaTeX commands such as "this is \textbf{bold} text" (the doubled backslashes in the strings represent Perl escapes, and will be evaluated to single backslashes). "iquotes" If true then single or double quotes around words will be changed to LaTeX single or double quotes; double quotes around a phrase will be converted to "``" and "''" and single quotes to "`" and "'". This is sometimes called "intelligent quotes" "use_textcomp" By default the "latex_encode" filter will encode characters with the encodings provided by the "textcomp" LaTeX package (for example the Pounds Sterling symbol is encoded as "\textsterling{}"). Setting "use_textcomp = 0" turns off these encodings. NOT YET IMPLEMENTED EXAMPLES
The following snippet shows how data from a database can be encoded and inserted into a LaTeX table, the source of which is generated with "LaTeX::Table". my $sth = $dbh->prepare('select col1, col2, col3 from table where $expr'); $sth->execute; while (my $href = $sth->fetchrow_hashref) { my @row; foreach my $col (qw(col1 col2 col3)) { push(@row, latex_encode($href->{$col})); } push @data, @row; } my $headings = [ [ 'Col1', 'Col2', 'Col3' ] ]; my $table = LaTeX::Table->new( { caption => 'My caption', label => 'table:caption', type => 'xtab', header => $header, data => @data } ); my $table_text = $table->generate_string; Now $table_text can be interpolated into a LaTeX document template. DIAGNOSTICS
None. You could probably break the "latex_encode" function by passing it an array reference as the options, but there are no checks for that. CONFIGURATION AND ENVIRONMENT
Not applicable. DEPENDENCIES
The "HTML::Entities" and "Pod::LaTeX" modules were used for building the encoding table in "LaTeX::Encode::EncodingTable", but this is not rebuilt at installation time. The "LaTeX::Driver" module is used for formatting the character encodings reference document. INCOMPATIBILITIES
None known. BUGS AND LIMITATIONS
Not all LaTeX special characters are included in the encoding tables (more may be added when I track down the definitions). The "use_textcomp" option is not implemented. AUTHOR
Andrew Ford <a.ford@ford-mason.co.uk> LICENSE AND COPYRIGHT
Copyright (C) 2007 Andrew Ford. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
Template::Plugin::Latex perl v5.10.0 2007-10-02 LaTeX::Encode(3pm)
All times are GMT -4. The time now is 02:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy