The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to detect failure from batch SFTP and SHELL operations chengwei Shell Programming and Scripting 2 05-28-2008 04:32 AM
Unix File operations nivas Shell Programming and Scripting 14 02-11-2008 02:27 AM
Unix Shell Script with output to CSV File heather.morton@ UNIX for Advanced & Expert Users 1 01-28-2008 10:18 AM
File operations chiragmistry21 Shell Programming and Scripting 2 03-27-2006 02:00 PM
mathematics operations in unix cesar720213 UNIX for Dummies Questions & Answers 2 11-22-2001 08:24 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-07-2008
nivas
Guest
 

Posts: n/a
Unix file operations(shell script)

Hi,

I want to compare two files. Files will look like as follows:

file1:
ASDFGHJU|1234567890123456
QWERTYUI|3456789098900890
file2:
ZXCVBVNM|0987654321234567
POLKIJUYH|1234789060985478

output file should be:
ASDFGHJU|1234567890123456
QWERTYUI|3456789098900890


Thnaks in advance
Reply With Quote
Forum Sponsor
  #2  
Old 02-07-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
... and what is the 'criteria'?
Reply With Quote
  #3  
Old 02-07-2008
nivas
Guest
 

Posts: n/a
Unix file operations(shell script)

I want to get the contents that are not present in file2.

I.e File1 and file2 should be compared and output file should be the contents that are present in file 1 and not present in file2.

Please help me. thanks.
Reply With Quote
  #4  
Old 02-07-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
if the files are sorted, look into 'man comm'
also look into 'man egrep'

Last edited by vgersh99; 02-07-2008 at 03:53 AM.
Reply With Quote
  #5  
Old 02-07-2008
nivas
Guest
 

Posts: n/a
Unix file operations(shell script)

I don't want to use diff command. because it displays other things also while comparing.

1d0
< CREDPOST|6001123412341234

I don't want

1d0
<

Please give me a command.
Reply With Quote
  #6  
Old 02-07-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
pls read my previous post!
Reply With Quote
  #7  
Old 02-07-2008
nivas
Guest
 

Posts: n/a
Unix file operations(shell script)

THanks,

comm command works fine.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0