Search Results

Search: Posts Made By: Mrinal Mondal
2,311
Posted By Scrutinizer
To get unique results you could just run...
To get unique results you could just run everything throught sort -u:
grep -xFf file1 file2 | sort -u
or
awk 'NR==FNR{A[$1]; next}$1 in A' file1 file2 | sort -u



--
Alternatively, one...
2,311
Posted By Vikram_Tanwar12
You can also try like this 1st sort both...
You can also try like this

1st sort both the files

sort filename1 -o filename1
sort filename2 -o filename2

then try

comm -12 filename1 filename2
2,311
Posted By Scrutinizer
If I run both scripts on your sample: $...
If I run both scripts on your sample:


$ cat file1
Milestone1
Milestone2
Milestone3
Milestone4
Milestone5
Milestone6
$ cat file2
Milestone1
Milestone12
Milestone13
Milestone14...
2,311
Posted By Scrutinizer
You would need to redirect the output: grep...
You would need to redirect the output:
grep -xFf file1 file2 > file3

An alternative would be:
awk 'NR==FNR{A[$1]; next}$1 in A' file1 file2 > file3
2,311
Posted By Scrutinizer
Hi, try: grep -xFf file1 file2
Hi, try:
grep -xFf file1 file2
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 08:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy