From 2 files create 3rd file with uncommon data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting From 2 files create 3rd file with uncommon data
# 1  
Old 02-13-2017
From 2 files create 3rd file with uncommon data

Hi All,

I have two files. File1 and File2.

Want to create another file with all the records of File1 those are not present in File2.

Please guide.

Thanks in advanced.
Anupam
# 2  
Old 02-13-2017
Have you tried comm?
This User Gave Thanks to Don Cragun For This Post:
# 3  
Old 02-13-2017
Quote:
Originally Posted by Don Cragun
Have you tried comm?


Code:
comm -23 file1.txt file2.txt

did the trick. Thank you.
This User Gave Thanks to Anupam_Halder For This Post:
# 4  
Old 02-13-2017
I'm glad it worked for you. Thank you for sharing your solution.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Create file based on data from two other files

I have looked through several threads regarding merging files with awk and attempted using join however have been unsuccessful likely as I do not fully understand awk. What I am attempting is to take a csv file which could be between 1 and 15,000 lines with 5 colums and another csv file that will... (4 Replies)
Discussion started by: cdubu2
4 Replies

2. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

3. Shell Programming and Scripting

Find uncommon in one file from data in another file

Hello, I have 2 files. File A and File B File A has below data 2000328288038 02 <-- its 02 2000292181441 11 2000292181441 11 2000000073963 25 2000075097222 22 File B has below data 2000328288038,2,1234 <-- 2 (it should also be taken care) 2000292181441,11,1233... (2 Replies)
Discussion started by: mirwasim
2 Replies

4. Shell Programming and Scripting

comparing 2 files and creating third file with uncommon content

I want to compare 2 files and create third file with uncommon content. e.g. file1 ajay suhas tom nisha vijay mahish file2 ajay suhas tom nisha expected output file content vijay mahish Is it possible in single command ? Thanks, Ajay (6 Replies)
Discussion started by: ajaypatil_am
6 Replies

5. UNIX for Dummies Questions & Answers

UNcommon lines between files

I have two files, file1.txt and file2.txt I want to find UNcommon between two files with while read line do grep -v $line file2.txt done<file1.txt I get the reverse grep for every line it reads (7 Replies)
Discussion started by: FelipeAd
7 Replies

6. Shell Programming and Scripting

Need help in writing a script to create a new text file with specific data from existing two files

Hi, I have two text files. Need to create a third text file extracting specific data from first two existing files.. Text File 1: Format contains: SQL*Loader: Release 10.2.0.1.0 - Production on Wed Aug 4 21:06:34 2010 some text ............so on...and somwhere text like: Record 1:... (1 Reply)
Discussion started by: shashi143ibm
1 Replies

7. Shell Programming and Scripting

How do I create an array from a file using every 3rd line

A file contains the following information shown below. Every ceName has 2 consecutive lines that have to be evaluated, using awk, sed, cut (any common unix tools). Input file: ceName: Node-1 processName: tzMgmt Status: PROCESS_NOT_RUNNING ceName: Node-2 processName: tzMgmt Status:... (15 Replies)
Discussion started by: BRH
15 Replies

8. Shell Programming and Scripting

Compare two csv files by two colums and create third file combining data from them.

I've got two large csv text table files with different number of columns each. I have to compare them based on first two columns and create resulting file that would in case of matched first two columns include all values from first one and all values (except first two colums) from second one. I... (5 Replies)
Discussion started by: agb2008
5 Replies

9. Post Here to Contact Site Administrators and Moderators

program to find the uncommon numbers between two files.

Hi, I need to extract the uncommon numbers from file1 and file2 For Example: File1 1 2 3 4 5 File2 1 2 3 4 5 6 (2 Replies)
Discussion started by: salaathi
2 Replies

10. Shell Programming and Scripting

extracting uncommon part between two files

Hi, I need to extract the uncommon (better say incremental) part from 2 files say file_1 and file_2. file_2 contains everything that is in file_1. That is file_2 has been created internally somehow : cat file_1 temp_file > file_2 My objective is to extract the temp_file part from... (2 Replies)
Discussion started by: sabyasm
2 Replies
Login or Register to Ask a Question