Replace last value in row with 0

  • Hi,

    I have a .csv file, which I need to zero out as part of our monthly process. The file has the following structure:

    Year;MPC ID;Company;Unit;Costcode;Name;Headcount
    2017;16699101;12000000;1001;1271120000;N. Jensen ;1
    2017;16699201;12000000;1001;1271120000;N. Jensen ;1
    2017;16699101;2009;5936;2010;A. Fevang ;1
    2017;16699201;2009;5936;2010;A. Fevang ;1
    2017;16699101;2009;4100;3050;L. Halstein ;1
    2017;16699201;2009;4100;3050;L. Halstein ;1
    2017;16699124;2009;4403;2260;K. Basalt ;1
    2017;16699224;2009;4403;2260;K. Basalt ;1
    2017;16699101;2009;92;9010;M. Kalsas ;1
    2017;16699201;2009;92;9010;M. Kalsas ;1
    2017;16699103;2009;3541;2100;B. Fonag ;0.5
    2017;16699203;2009;3541;2100;B. Fonag ;1
    2017;16699101;2009;4403;2260;S. Jørgensen ;0.35
    2017;16699201;2009;4403;2260;S. Jørgensen ;1
    2017;16699101;2009;4403;2260;K. Pedersen ;0.69
    2017;16699201;2009;4403;2260;K. Pedersen ;1

    Currently I copy/paste the content over to Excel where it’s easy for me to apply zeroes in the last column. However I would really like to process this within Notepad++. So how would I replace any ending value ‘;x’ with ‘;0’?

    I have been trying to find relevant examples in the forum, however didn’t succeed to adapt similar solutions for my problem.

    Thank you in advance

  • A regular expression replace will work for your situation:

    Find-what box: [\d.]+$
    Replace-with box: 0
    Search mode: Regular expression

    The rough English explanation of the parts of this is:
    [\d.]: look for digit or period in any order
    [\d.]+: look for one or more digits or periods in any order
    [\d.]+$: look for one or more digits or periods in any order at the end of a line

  • That worked like a charm. Thanks a stack Scott. :)
    And also thanks for elaborating. That’ll really help going onwards to getting more acquainted with these strings.