Sponsored Content
Full Discussion: compare data
Top Forums UNIX for Dummies Questions & Answers compare data Post 41604 by bensky on Thursday 9th of October 2003 10:49:04 AM
Old 10-09-2003
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 any character or number, but its not important what character or number stands there. The rest of the string must be identical to the string in the pattern file.

Is this possible to check in a unix script???
I tried to do this with sed and diff, but it was not successfull...

Thanx for help

Ben Sky
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. UNIX for Dummies Questions & Answers

how do i compare and extract similiar data

I have 2 files. The first file contains user names in one column. The second, and considerably longer, file contains user names in the first column and corresponding full names in the second column. Currently these are in the .xls format. I'd like to be able to compare file1 with file2 and extract... (2 Replies)
Discussion started by: raptrmastr
2 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

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=$5;next} $1 in a {if ($5==a) t=0; else {t=$5-a};print $0,t}' file.tsv file2.tsv please... (3 Replies)
Discussion started by: Shenbaga.d
3 Replies

8. 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

9. 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

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
Apache::TestUtil(3)					User Contributed Perl Documentation				       Apache::TestUtil(3)

NAME
Apache::TestUtil - Utility functions for writing tests SYNOPSIS
use Apache::Test; use Apache::TestUtil; ok t_cmp("foo", "foo", "sanity check"); t_write_file("filename", @content); my $fh = t_open_file($filename); t_mkdir("/foo/bar"); t_rmtree("/foo/bar"); t_is_equal($a, $b); DESCRIPTION
"Apache::TestUtil" automatically exports a number of functions useful in writing tests. All the files and directories created using the functions from this package will be automatically destroyed at the end of the program exe- cution (via END block). You should not use these functions other than from within tests which should cleanup all the created directories and files at the end of the test. FUNCTIONS
t_cmp() t_cmp($expected, $received, $comment); t_cmp() prints the values of $comment, $expected and $received. e.g.: t_cmp(1, 1, "1 == 1?"); prints: # testing : 1 == 1? # expected: 1 # received: 1 then it returns the result of comparison of the $expected and the $received variables. Usually, the return value of this function is fed directly to the ok() function, like this: ok t_cmp(1, 1, "1 == 1?"); the third argument ($comment) is optional, mostly useful for telling what the comparison is trying to do. It is valid to use "undef" as an expected value. Therefore: my $foo; t_cmp(undef, $foo, "undef == undef?"); will return a true value. You can compare any two data-structures with t_cmp(). Just make sure that if you pass non-scalars, you have to pass their references. The datastructures can be deeply nested. For example you can compare: t_cmp({1 => [2..3,{5..8}], 4 => [5..6]}, {1 => [2..3,{5..8}], 4 => [5..6]}, "hash of array of hashes"); You can also compare the second argument against the first as a regex. Use the "qr//" function in the first argument. For example: t_cmp(qr/^abc/, "abcd", "regex compare"); will do: "abcd" =~ /^abc/; This function is exported by default. t_debug() t_debug("testing feature foo"); t_debug("test", [1..3], 5, {a=>[1..5]}); t_debug() prints out any datastructure while prepending "#" at the beginning of each line, to make the debug printouts comply with "Test::Harness"'s requirements. This function should be always used for debug prints, since if in the future the debug printing will change (e.g. redirected into a file) your tests won't need to be changed. This function is exported by default. t_write_file() t_write_file($filename, @lines); t_write_file() creates a new file at $filename or overwrites the existing file with the content passed in @lines. If only the $filename is passed, an empty file will be created. If parent directories of $filename don't exist they will be automagically created. The generated file will be automatically deleted at the end of the program's execution. This function is exported by default. write_shell_script() write_shell_script($filename, @lines); Similar to t_write_file() but creates a portable shell/batch script. The created filename is constructed from $filename and an appro- priate extension automatically selected according to the platform the code is running under. It returns the extension of the created file. write_perl_script() write_perl_script($filename, @lines); Similar to t_write_file() but creates a executable Perl script with correctly set shebang line. t_open_file() my $fh = t_open_file($filename); t_open_file() opens a file $filename for writing and returns the file handle to the opened file. If parent directories of $filename don't exist they will be automagically created. The generated file will be automatically deleted at the end of the program's execution. This function is exported by default. t_mkdir() t_mkdir($dirname); t_mkdir() creates a directory $dirname. The operation will fail if the parent directory doesn't exist. If parent directories of $dirname don't exist they will be automagically created. The generated directory will be automatically deleted at the end of the program's execution. This function is exported by default. t_rmtree() t_rmtree(@dirs); t_rmtree() deletes the whole directories trees passed in @dirs. This function is exported by default. chown() Apache::TestUtil::chown($file); Change ownership of $file to the test's User/Group. This function is noop on platforms where chown(2) is unsupported (e.g. Win32). t_is_equal() t_is_equal($a, $b); t_is_equal() compares any two datastructures and returns 1 if they are exactly the same, otherwise 0. The datastructures can be nested hashes, arrays, scalars, undefs or a combination of any of these. See t_cmp() for an example. If $a is a regex reference, the regex comparison "$b =~ $a" is performed. For example: t_is_equal(qr{^Apache}, $server_version); If comparing non-scalars make sure to pass the references to the datastructures. This function is exported by default. AUTHOR
Stas Bekman <stas@stason.org> SEE ALSO
perl(1) perl v5.8.0 2002-01-06 Apache::TestUtil(3)
All times are GMT -4. The time now is 05:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy