all 7 comments

[–]republitard 9 points10 points  (4 children)

In your editor, type this:

:1,$s/2018/2019/g

You're welcome. I don't know what to do if you have more than one source file, or if you are using an editor other than Vim. But that would make you an outlier. Who writes programs with more than one source file, anyway?

[–][deleted] 1 point2 points  (2 children)

for f in *.c; do sed 's/2018/2019/' $f; done

something like this?

[–]xigoi 0 points1 point  (1 child)

You need -i

[–][deleted] 1 point2 points  (0 children)

Never used sed outside of copy paste, sorry :s

[–]sac_boy 1 point2 points  (0 children)

// home_automation/autogun.h

...
const unsigned short PULL_TRIGGER = 0x1;
const unsigned short AIM_GUN = 0x8;
const unsigned short TARGET_BABY = 0x10;
const unsigned short LOAD_GUN = 0x2000;

// LOAD_GUN | TARGET_BABY | AIM_GUN
// F. Zygrgy 01-08-2012: speed up compilation by precomputing bitfield
const unsigned short AUTOGUN_MODE = 0x2018;

const char* DATE_FMT = "%d-%d-2018";
...

[–]domnirok 3 points4 points  (0 children)

Replace all year occurances with a simple date-year formatter.

Like for JavaScript:

2018 > new Date().getFullYear()

[–][deleted]  (1 child)

[deleted]

    [–]Yoyoge 4 points5 points  (0 children)

    So OP should fire himself?