. f_askfname.sh
. f_askstring.sh
ask_filename "Target File( Blank is Cancel. ): " 1
if [ $? -ne 0 ]; then
echo "*** Canceled."
return 1
fi
FILE1=${_STR}
echo "Target File is \"${FILE1}\""
ask_string "Save File [${FILE1}.uniq]; " 1
if [ $? -ne 0 ]; then
FILE2="${FILE1}.uniq"
else
FILE2=${_STR}
fi
echo "Save File is \"${FILE2}\""
sort -f ${FILE1} | uniq -ic > ${FILE2}
echo "*** Successful."
unset FILE1 FILE2 _STR
$ cat 1.txt
aa
bb
cc
dd
ee
aa
aa
aa
bb
bb
cc
$ ./sortuniq.sh
Target File( Blank is Cancel. ): 1.txt
Target File is "1.txt"
Save File [1.txt.uniq];
Save File is "1.txt.uniq"
*** Successful.
$ cat 1.txt.uniq
4 aa
3 bb
1 cc
1 cc
1 dd
1 ee