|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need command
I have two files File1, File2. File1 has whole list of IDs and File2 has a limited IDs. i need to compare these two files and take the IDs which are not present in File2 but present in File1. can someone tell me a command.
|
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
grep.
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Maybe some script? Code:
#!/bin/sh cat $1 | while read LINE; do exist=`grep $LINE $2` if [ ! -z $exist ]; then echo $exist >> exists_in_file1.txt fi done Code:
server1 # ./diff.sh file1 file2 I assume that each line has only one ID. If your files are large, then performance of that script can be a problem. Of course Scott has right and grep work fine too: Code:
server1 # grep -f file1 file2 |
| The Following User Says Thank You to GP81 For This Useful Post: | ||
JSKOBS (01-23-2013) | ||
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| passing command output from one command to the next command in cshell | kaaliakahn | UNIX for Dummies Questions & Answers | 2 | 02-10-2012 04:59 PM |
| Need help! command working ok when executed in command line, but fails when run inside a script! | 4dirk1 | Shell Programming and Scripting | 4 | 12-02-2010 05:47 AM |
| AIX:Command to get netaddress/subnet address command in IPv4/IP6 | rookie8278 | AIX | 2 | 06-17-2009 11:35 AM |
| assign a command line argument and a unix command to awk variables | sweta_doshi | Shell Programming and Scripting | 0 | 08-08-2008 06:54 AM |
| inconsistent ls command display at the command prompt & running as a cron job | rajranibl | SuSE | 5 | 07-30-2007 08:26 AM |
|
|