Check date's format and change its format

  • Thread starter Thread starter corfuitl
  • Start date Start date
C

corfuitl

Hi all,

I have a text that contain dates and maybe number of chapters that look like a date and I would like to convert the dates in another format if they are valid.

For example, the text

Code:
Today is 2.6.2014 and I read the chapter 32.1.14
should be converted into

Code:
Today is 2/6/2014 and I read the chapter 32.1.14
I know to use the date -d "$date" but I don’t know how to keep the date in a var and then make the replacement.

Do you have any idea?

Thanks for your time.

Continue reading...
 
Back
Top