Issue
I have some files containing yaml where I need to add single quotes around the values of some date fields.
For example:
pubDate: 2016-10-10T08:22:00.000Z
Should be updated to
pubDate: '2016-10-10T08:22:00.000Z'
I think this can be done using something like sed. How can I achieve this?
Solution
Using sed:
sed 's/^pubDate: \([-:.[:alnum:]]\+\)$/pubDate: '"'"'\1'"'"'/' FILE
I assume that pubDate: <timestamp>
is the only content on the line.
Answered By - user14967413 Answer Checked By - Cary Denson (WPSolving Admin)