hi,
i have a problem with linux redhat .
I have a sequencial files and i want to delete a duplicate records .
How i can to do.
Thanks lot
Regards
What is the file name ?
try
sort -u <filename> >> new_filename
rm filename
mv new_filename filename
example :
100212903062|74247966|MTW|2013082712:00:00|2017052512:00:00|2017052512:00:00|1-2PKWW7I|BTS_FLAS|F||ABR|7000.0|ATM||8|35|256.0|256.0|2130|11|271|256.0||MILAITBR|0021290
3062 W40|2130|0255017800|
100212903062|74247966|MTW|2013082712:00:00|2017052512:00:00|2017052512:00:00|1-2PKWW7P|BTS_FLAS|F||ABR|7000.0|ATM||8|36|256.0|256.0|2130|11|272|256.0||MILAITBR|0021290
3062 W40|2130|0255017800
i want to delete a row beacase there is a duplicate file in the first field .
Thanks a lot
I guess - as you didn't specify a field separator - the pipe chars are, and your first field is 100212903062
. Did you consider sort
's -k
option to define key fields?
Sort my file with option
more <file> | sort -k1
how can i delete a duplicate row?
Thanks a lot
Regards
I don't think you want to use more file | sort ...
.
Did you try arunkumar_mca's proposal, and does it do what you want for identical lines? If yes, extend the sort by -t"|" -k1,1
. And, read the man
page...