Find and replace date within a file

Posted by user1629011 on Stack Overflow See other posts from Stack Overflow or by user1629011
Published on 2012-09-01T07:32:20Z Indexed on 2012/09/01 9:38 UTC
Read the original article Hit count: 138

Filed under:
|

My apologies if my title is not descriptive enough, I believe the following will be. I have 3 files which are just plain text, within each file, is a date

Date: 2012-08-31 for example

I would like to get a command/script to find this and update to the current date, but the date will be ever changing and may not be known going in (without viewing the contents of the file

Knowing what the date is, its simple enough with sed, but how can I do this knowing the syntax of the line I want to modify, but not the specific values. ("Date: " at least is unchanging)

© Stack Overflow or respective owner

Related posts about bash

Related posts about sed