Saikat
Saikat

Reputation: 1

Deleting strings after a certain column in Notepad++

I have a set of data which looks like this

XXXYYY,20151001,09:16,17370.40,17390.60,17362.40,17381.00,50,0

What I want to do is, deleting everything after the value 17381.00 i.e delete ",50,0".I have 7500 rows of such data and column number after 17381.00 is 61 in all rows.

What i am looking for is to able to delete everything from column 61.

The expected output is XXXYYY,20151001,09:16,17370.40,17390.60,17362.40,17381.00

Upvotes: 0

Views: 473

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521259

You may try the following find and replace, in regex mode:

Find:    ^((?:[^,]*,){59}[^,]*),.*$
Replace: $1

Here is an explanation of the regex pattern:

^
(
    (?:[^,]*,){59}  match and capture 'xxx,' 59 times
    [^,]*           match and capture 'xxx' (no comma)
)
,                   match a ,
.*                  consume the remainder of the line
$

Then, we replace with just the capture group $1, effectively removing columns 61 onwards.

Demo

Upvotes: 1

Related Questions