I have file which is having large data in it. and there are some repeated rows. Basic idea here is : Sort data, remove duplicates based on first field and then print the whole....
I have tried teh following but no help..
#!/bin/sh
if [ $# -ne 1 ]
then
echo "Usage - $0 file-name"
exit 1
fi
if [ -f $1 ]
then
echo "$1 file exist"
sort -u $1 > results.cvs
awk '!x[$0]++' results.cvs > results-new.cvs
else
echo "Sorry, $1 file does not exist"
fi
Input data and expected out put data Attached :
trying in HP-UNIX