Remove the time from the date column

Hi,
I have file named file1.txt with below contents

cat file1.txt
1/29/2014 0:00,706886
1/30/2014 0:00,791265
1/31/2014 0:00,987087
2/1/2014 0:00,1098572
2/2/2014 0:00,572477
2/3/2014 0:00,701715

I want to display as below

1/29/2014,706886
1/30/2014,791265
1/31/2014,987087
2/1/2014,1098572
2/2/2014,572477
2/3/2014,701715

Try this:

awk  -F"[ ,]" '{print $1, $3}' OFS=, file

GNU Awk 4.0.1

awk -v FS=" |," -v OFS="," '{print $1, $3}' file1.txt 

I tripple checked and still managed to post a longer duplicate answer :slight_smile:

sed 's# .*,#,#' file

OR you may try :

$ awk 'gsub(/[0-9]+:[0-9]+|[[:space:]]/,x,$1)' OFS=, FS=,   file

I really thank all the person who sent their response.
All the commands are working.I am happy to access this forum