![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Can I know find syntax to find given date files | bache_gowda | Shell Programming and Scripting | 3 | 03-26-2008 06:37 AM |
| Find duplicates from multuple files with 2 diff types of files | ricky007 | Shell Programming and Scripting | 2 | 03-04-2008 01:46 PM |
| union of two files | sherkaner | Shell Programming and Scripting | 3 | 10-02-2007 06:22 PM |
| Little bit weired : Find files in UNIX w/o using find or where command | jatin.jain | Shell Programming and Scripting | 10 | 09-19-2007 07:47 AM |
| Find files older than 20 days & not use find | halo98 | Shell Programming and Scripting | 2 | 05-18-2006 03:19 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Is there a command in unix to find the union of two files and removing the union from one of the files? e.g. I have two files input1.txt and input2.txt with the contents below: Code:
$ more input1.txt 4 2 3 2 $ more input2.txt 5 4 4 8 2 I want to find the union of the two and remove the union from input1.txt to output the below: 3 Any help will be appreciated. |
|
||||
|
Thanks Livio However your code did not give input1.txt minus the union of input1.txt and input2.txt which is 3. I worked out that I can do this by the code below but is there a simpler way to do this using standard Unix commands? (possibly in one line?) Code:
cat input1.txt input2.txt | sort | uniq -d > union cat input1.txt union | sort | uniq -c > union2 sed -n '/1 /p' union2 > union3 sed -e 's/ 1 //g' union3 Last edited by stevefox; 12-06-2005 at 10:46 PM.. |
![]() |
| Bookmarks |
| Tags |
| unix commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|