Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Comparison of 2 files in UNIX Post 302145198 by kahuna on Tuesday 13th of November 2007 07:13:15 AM
Old 11-13-2007
Quote:
Originally Posted by Dana Evans
file1 and file2 have column values of a specific oracle table exported and stored in Unix system
Most SQL tables have a key field or fields. Normally the key field would be used to identify and match the record to determine if it has changed. But from your requirement, this is not what you are looking for.

Also, normally SQL queries do not guarantee the order of records unless the order by clause is used. So, without order by, the same query executed twice could, theoretically, return the same records in two totally different orders.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix comparison

I am very new to Unix. What are the similiarities and differences between ScoUnix and AIX5 if any? Where might i find the information? Which is better? (1 Reply)
Discussion started by: NewGuy100
1 Replies

2. Shell Programming and Scripting

comparison of 2 files

Kindly help on follows. I have 2 files. One file contains only one column of mobile numbers. And total records in a file 12 million. Second file contains 2 columns mobile numbers and balance. and total records 30 million. I want to find out balance of each data in file 1 corresponding to file 2.... (2 Replies)
Discussion started by: kamal_418
2 Replies

3. Shell Programming and Scripting

Comparison of two files (sh)

Hi, I have a problem with comparison of two files file1 20100101 20090101 20080101 20071001 20121229 file2 19990112 12 456 7 20011131 19 20100101 2 567 1 987 17890709 123 555 and, sh script needs to compare of these two files and give out to me result: 20100101 2 567 1 987 it... (5 Replies)
Discussion started by: shizik
5 Replies

4. Shell Programming and Scripting

comparison of 2 files using unix or awk

Hello, I have 2 files and I want them to be compared in a specific fashion file1: A_1200_1250 A_1251_1300 B_1301_1350 B_1351_1400 B_1401_1450 C_1451_1500 and so on... file2: 1210 1305 1260 1295 1400 1500 1450 1495 Now The script should look for "1200" from A_1200_1250 of... (8 Replies)
Discussion started by: Diya123
8 Replies

5. Shell Programming and Scripting

Comparison of two files

Hi all I have two files which I have to compare that whetehr there is soemthing common or not body, div, table, thead, tbody, tfoot, tr, th, td, p { font-family: "Liberation Sans"; font-size: x-small; } body, div, table, thead, tbody, tfoot,... (2 Replies)
Discussion started by: manigrover
2 Replies

6. Shell Programming and Scripting

File comparison in UNIX columnwise

Hi all, I want to compare two files with same number of rows and columns with records in same order. Just want to highlight the differences in the column values if any. file A 1,kolkata,19,ab 2,delhi,89,cd 3,bangalore,56,ef file2: 1,kolkata,21,ab 2,mumbai,89,gh 3,bangalore,11,kl... (9 Replies)
Discussion started by: prabhat.diwaker
9 Replies

7. Shell Programming and Scripting

Comparison between two files through UNIX script

Hi All , As I am new to unix scripting ,I need a help regarding unix scripting .I have two .txt files .One is source file and another is target file.I need a script through which I can compare those two files.I need a automated comparison report in a directory after comparing between source &... (2 Replies)
Discussion started by: STCET22
2 Replies

8. Shell Programming and Scripting

Need help regarding comparison between two files through UNIX script

Hi All , I am aware of unix command ,but not comforable in putting together in script level.I came to situation where I need to compare between two .txt files fieldwise and need a mismatch report. As I am new to unix script arena ,if anyone can help in the below scenario that will be really... (9 Replies)
Discussion started by: STCET22
9 Replies

9. Shell Programming and Scripting

UNIX file comparison

I have two files which has component name and version number separated by a space cat file1 com.acc.invm:FNS_PROD 94.0.5 com.acc.invm:FNS_TEST_DCCC_Mangment 94.1.6 com.acc.invm:FNS_APIPlat_BDMap 100.0.9 com.acc.invm:SendEmail 29.6.113 com.acc.invm:SendSms 12.23.65 cat file2 ... (8 Replies)
Discussion started by: rakeshtomar82
8 Replies

10. Shell Programming and Scripting

Comparison of files

I have the requirement I have two files cat fileA something anythg nothing everythg cat fileB everythg anythg Now i shld use fileB and compare every line at fileA and get the output as something nothing (3 Replies)
Discussion started by: Priya Amaresh
3 Replies
NetSDS::DBI::Table(3pm) 				User Contributed Perl Documentation				   NetSDS::DBI::Table(3pm)

NAME
NetSDS::DBI::Table SYNOPSIS
use NetSDS::DBI::Table; my $q = NetSDS::DBI::Table->new( dsn => 'dbi:Pg:dbname=netsdsdb;host=127.0.0.1', user => 'netsds', passwd => 'test', table => 'public.messages', ) or warn NetSDS::DBI::Table->errstr(); DESCRIPTION
"NetSDS::DBI::Table" module provides commonly used CRUD functionality for data stored in single database. Main idea was that we can agree about some limitations: * every such table contains "id" field that is primary key * we use PostgreSQL DBMS with all it's features CLASS API
new([...]) - class constructor my $tbl = NetSDS::DBI::Table->new( dsn => 'dbi:Pg:dbname=content', login => 'netsds', passwd => 'topsecret, table => 'content.meta', ); fetch(%params) - get records from table as array of hashrefs Paramters (hash): * fields - fetch fields by list * filter - arrayref of SQL expressions like "status = 'active'" for "WHERE" clause * order - arrayref of SQL expressions like "id desc" for "ORDER BY" clause * limit - max number of records to fetch (LIMIT N) * offset - records to skip from beginning (OFFSET N) * for_update - records selected for further update within current transaction Returns: message as array of hashrefs Sample: my @messages = $q->fetch( fields => ['id', 'now() as time'], filter => ['msg_status = 5', 'date_received < now()'], # where msg_status=5 and date_received < now() order => ['id desc', 'src_addr'], # order by id desc, src_addr limit => 3, # fetch 3 records offset => 5, # from 6-th record for_update => 1, # for update ) insert_row(%key_val_pairs) - insert record into table Paramters: record fields as hash Returns: id of inserted record my $user_id = $tbl->insert_row( 'login' => 'vasya', 'password' => $encrypted_passwd, ); insert(@records_list) - mass insert Paramters: list of records (as hashrefs) Returns: array of inserted records "id" This method allows mass insert of records. my @user_ids = $tbl->insert( { login => 'vasya', password => $str1 }, { login => 'masha', password => $str2 }, { login => 'petya', password => $str3, active => 'false' }, ); Warning! This method use separate INSERT queries and in fact is only wrapper for multiple "insert_row()" calls. So it's not so fast as one insert but allows to use different key-value pairs for different records. update_row($id, %params) - update record parameters Paramters: id, new parameters as hash Returns: updated record as hash Example: my %upd = $table->update_row($msg_id, status => 'failed', dst_addr => '380121234567', ); After this %upd hash will contain updated table record. update(%params) - update records by filter Paramters: filter, new values $tbl->update( filter => ['active = true', 'created > '2008-01-01'], set => { info => 'Created after 2007 year', } ); get_count(%params) - retrieve number of records Just return total number of records by calling: # SELECT COUNT(id) FROM schema.table my $count = $tbl->get_count(); my $count_active = $tbl->get_count(filter => ['active = true']); delete_by_id(@ids) - delete records by identifier Paramters: list of record id Returns: 1 if ok, undef if error Method deletes records from SQL table by it's identifiers. if ($tbl->remove(5, 8 ,19)) { print "Records successfully removed."; } delete(@filters) - delete records Paramters: list of filters Returns: 1 if ok, undef if error $tbl->delete( 'active = false', 'expire < now()', ); get_fields() - get list of fields Example: my @fields = @{ $tbl->get_fields() }; print "Table fields: " . join (', ', @fields); has_field($field) - check if field exists Paramters: field name Example: if ($tbl->has_field('uuid')) { $tbl->call("delete tbldata where uuid=?", $uuid); } NOTE: this method works only for restricted tables that use "fields" parameter at construction time. EXAMPLES
See "samples/test_db_table.pl" script BUGS
Bad documentation SEE ALSO
NetSDS::DBI <http://en.wikipedia.org/wiki/Create,_read,_update_and_delete> TODO
None AUTHOR
Michael Bochkaryov <misha@rattler.kiev.ua> LICENSE
Copyright (C) 2008-2009 Net Style Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA perl v5.10.1 2010-04-28 NetSDS::DBI::Table(3pm)
All times are GMT -4. The time now is 08:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy