You are here: PSPad forum > English discussion forum > Re: delete five character of the end of line

Re: delete five character of the end of line

#1 delete five character of the end of line

Posted by: Esgrimidor | Date: 03/07/2017 12:05 | IP: IP Logged

I have a txt file with many lines ending in different character of lenght 5

I wish to delete the five characters in each line

How can I do that ?

Best Regards

--
Nice program indeed

Options: Reply | Quote | Up ^


#2 Re: delete five character of the end of line

Posted by: pspad | Date: 03/07/2017 12:25 | IP: IP Logged

Use regular expressions in Find/Replace dialog:

search: ^(.*).{5,5}$
replace: $1
[x]Regular expressions

$1 is substitution for first part in bracket
You search for anything of any length from the begin of line in the first part and last any chars from the end in the second part of expression
You will replace with the first part - line without last 5 chars

Options: Reply | Quote | Up ^


#3 Re: delete five character of the end of line

Posted by: Stefan | Date: 03/07/2017 12:35 | IP: IP Logged

FROM:
123456789012345
12345678
TO:
1234567890
123

USE e.g.:
Search: (.+).....$
Replace: $1
[x]Regular expressions

- - -

For Regular Expressions syntax see
gogogadgetscott.info

. any character in line
+ one or more
$ end of line
Subexpressions $1

.

.

--
greets, Stefan
image (pleased user since 1722)
inofficial FAQs + Infos + Special Settings

Options: Reply | Quote | Up ^


#4 Re: delete five character of the end of line

Posted by: Esgrimidor | Date: 03/08/2017 13:14 | IP: IP Logged

i will try and comment.

Best Regards

--
Nice program indeed

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2017 Jan Fiala
Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák