Skip to content
Advertisement

How to change date format in linux/unix text file

I have sample.txt file in my linux system.all the data that is present in my file are in the following date format

JavaScript

I want to convert all this date format in my sample.txt file to YYYY-MM-DD Format.

Advertisement

Answer

It’s quite simple with date -d, e.g.

JavaScript

Input File

JavaScript

Example Use/Output

JavaScript
Advertisement