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 and shell scripting languages 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 08:32 AM
Unix File operations nivas Shell Programming and Scripting 14 02-11-2008 05:27 AM
Unix Shell Script with output to CSV File heather.morton@ UNIX for Advanced & Expert Users 1 01-28-2008 01:18 PM
File operations chiragmistry21 Shell Programming and Scripting 2 03-27-2006 06:00 PM
mathematics operations in unix cesar720213 UNIX for Dummies Questions & Answers 2 11-22-2001 11:24 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-07-2008
nivas
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
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
  #2 (permalink)  
Old 02-07-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
... and what is the 'criteria'?
  #3 (permalink)  
Old 02-07-2008
nivas
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
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.
  #4 (permalink)  
Old 02-07-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

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

Last edited by vgersh99; 02-07-2008 at 06:53 AM..
  #5 (permalink)  
Old 02-07-2008
nivas
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
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.
  #6 (permalink)  
Old 02-07-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
pls read my previous post!
  #7 (permalink)  
Old 02-07-2008
nivas
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Unix file operations(shell script)

THanks,

comm command works fine.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:38 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0