Hi.
A utility, dadd, in package dateutils can do the arithmetic and reformatting. It seems to be in many repositories ( e.g. arch, FreeBSD, Slackware, Mac OS X "brew" etc.), and source is available (github). I compiled it for an earlier version of Debian.
A single command suffices to process all conforming dates:
#!/usr/bin/env bash
# @(#) s1 Demonstrate date reformat, arithmetic, dateutils, dadd.
# "dadd" is part of dateutils, repository Debian/Jessie, MiNT, # Ubuntu, etc.
# Also: http://www.fresse.org/dateutils.
# Utility functions: print-as-echo, print-line-with-visual-space, debug.
# export PATH="/usr/local/bin:/usr/bin:/bin"
LC_ALL=C ; LANG=C ; export LC_ALL LANG
pe() { for _i;do printf "%s" "$_i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
db() { ( printf " db, ";for _i;do printf "%s" "$_i";done;printf "\n" ) >&2 ; }
db() { : ; }
C=$HOME/bin/context && [ -f $C ] && $C dadd
FILE=${1-data1}
pl " Input data file $FILE:"
cat $FILE
# In : MM/DD/YYYY HH:MM:SS
# Out: DD/Mon/YYYY HH:MM:SS
pl " Results:"
dadd -S -i '%m/%d/%Y' +1mo -f '%d/%b/%Y' < $FILE
exit 0
producing:
$ ./s1
Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian 5.0.8 (lenny, workstation)
bash GNU bash 3.2.39
dadd 0.2.6
-----
Input data file data1:
First line, no dates, some blank lines appear.
Today was: Mon Jul 6 08:18:06 CDT 2015
06/23/2015 20:59:12
Now is the time 06/23/2015 20:59:12 for all good men
No dates here.
When was 06/23/2015 20:59:12, another 06/23/2015 20:59:12, not 2015.06.23 20:59:12
Last line, no dates.
-----
Results:
First line, no dates, some blank lines appear.
Today was: Mon Jul 6 08:18:06 CDT 2015
23/Jul/2015 20:59:12
Now is the time 23/Jul/2015 20:59:12 for all good men
No dates here.
When was 23/Jul/2015 20:59:12, another 23/Jul/2015 20:59:12, not 2015.06.23 20:59:12
Last line, no dates.
Sample input and output are best to supply with the original question, otherwise responders need to create them, which may or may not match what is really needed.
Best wishes ... cheers, drl