I am trying to rename a folder with files which contain a datestamp like this:
string_DD-MM-YYYY_hhmm.pdf
to this format:
string_YYYY-MM-DD_hhmm.pdf
so that they sort by date when sorted by filename.
Example: PB_KAZ_KtoNr_0463266665_01-02-2014_0341.pdf
should become PB_KAZ_KtoNr_0463266665_2014-02-01_0341.pdf
.
I found this similar question but it's regarding DDMMYYYY format instead of DD-MM-YYYY and the answeres are way to complicated for my situation. As the string
always is the same in content and length (24 characters) a simple command, that splits and reassembles the string by positions would be sufficient.
Thanks in advance!
man sed(1)
orman awk(1)
. did you consult the manual? – humanityANDpeace Jan 07 '17 at 12:54