Hello,
Could you please try following, following will help you to create files according to first column.
awk -F" |," 'BEGIN{i=1;}{if(A != $1){i++}} {print $0 >> i".txt";A=$1}' Input_file
In this case 3 files will be created as only 3 unique dates are there in given input.
cat 4.txt
6/8/2014 8:05,6/8/2014,MTS_103,COMPLETE
6/8/2014 8:25,7/8/2014,MTS_104,COMPLETE
cat 3.txt
5/8/2014 5:10,5/8/2014,MTS_100,COMPLETE
5/8/2014 5:26,5/8/2014,MTS_101,COMPLETE
5/8/2014 5:30,5/8/2014,MTS_102,COMPLETE
cat 2.txt
4/8/2014 1:50,4/8/2014,MTS_68,COMPLETE
4/8/2014 2:30,4/8/2014,MTS_99,COMPLETE
EDIT: Just saw OP wants to show on command line only so following may help.
sort -k1 Input_file | awk -F" |," 'BEGIN{i=1;}{if(A != $1 && A){print "**************************************"}} {print $0;A=$1}'
Output will be as follows.
4/8/2014 1:50,4/8/2014,MTS_68,COMPLETE
4/8/2014 2:30,4/8/2014,MTS_99,COMPLETE
**************************************
5/8/2014 5:10,5/8/2014,MTS_100,COMPLETE
5/8/2014 5:26,5/8/2014,MTS_101,COMPLETE
5/8/2014 5:30,5/8/2014,MTS_102,COMPLETE
**************************************
6/8/2014 8:05,6/8/2014,MTS_103,COMPLETE
6/8/2014 8:25,7/8/2014,MTS_104,COMPLETE
You can print new line etc in place of ****
too. Hope this helps.
EDIT: Also if you need to take date as variable then following may help.
awk -F" |," -vs1="4/8/2014" '{if($1 ~ s1){print $0}}' Input_file
Output will be as follows.
4/8/2014 2:30,4/8/2014,MTS_99,COMPLETE
4/8/2014 1:50,4/8/2014,MTS_68,COMPLETE
Thanks,
R. Singh