Replace date value with another value keeping all as is

Hi forum.

How do I change the following date value with another value (while keeping the rest of the line) using sed? The date values can change so I need a general sed command to change the date value within the first quotation marks only.

Date values will be coming from 2 different files.

From:
$$EXTRACT_DATE=to_date('01/01/2010','mm/dd/yyyy')
$$EXTRACT_DATE=to_date('02/01/2010','mm/dd/yyyy')
$$EXTRACT_DATE=to_date('03/01/2010','mm/dd/yyyy')
...

To:
$$EXTRACT_DATE=to_date('01/01/2011','mm/dd/yyyy')
$$EXTRACT_DATE=to_date('02/06/2012','mm/dd/yyyy')
$$EXTRACT_DATE=to_date('06/06/2012','mm/dd/yyyy')
...

Thank you.

sed "s#'[^'][^']*#'newdate#1" myFile

replace
match pattern: single-quote followed by anything BUT a single-quote repeated 1 or more time
with
single-quote followed by a string newdate

1 - make the above substitution ONLY for the FIRST matched pattern

1 Like

Thanks vgersh99.

Can you explain the code please?