I have a code which is using to find duplicates in a files based on column.Below is the same code which is used to find duplicates in my file based on column 1
Ok You can leave ignore my previous post.So let me put my requirement here.
I have a pipe delimited file. I am trying to create a UNIX script which can be used across different files to print the duplicates line from the file.
For ex. I have two files A.txt and B.txt
A.txt
123|345|asd
122|ASD|DEF
123|ASW|231
For this file A.txt I need to print duplicate records based on first column.So my expected out put is
123|345|asd
123|ASW|231
B.txt
34|aw|asd
33|aq|qw
54|aq|qw
For this file B.txt I need to print duplicate records based on 2nd and 3rd column.My expected output is
33|aq|qw
54|aq|qw
So I need to write one script, where I can pass the column positions based on which the duplicate need to be checked can be passed as external parameter.
For the first file, sh test_script.sh 1
For the second file , sh test_script.sh "2,3" something like this