You are here: PSPad forum > English discussion forum > delete all lines not beginning with a predefined string

delete all lines not beginning with a predefined string

#1 delete all lines not beginning with a predefined string

Posted by: Esgrimidor | Date: 01/13/2018 14:52 | IP: IP Logged

how can i delete all lines except those beginning with a determined string. By example : Delete all lines except those beginning with "5234534".

Any equivalent task may help me like extract the lines beginning with a certain sring to a new file.

Best Regards

--
Nice program indeed

Options: Reply | Quote | Up ^


#2 Re: delete all lines not beginning with a predefined string

Posted by: pspad | Date: 01/13/2018 20:00 | IP: IP Logged

Use search functionality
Search for line containing your string, check Non matched lines and press COPY buttton
Into new file will be copied content what doesn't match

If you want lines, starting for some exact expression, use regular expression
Search for: ^5234534.*
[x]Regular expression
[x]Copy nonmatching + COPY button

You can use another way - empty lines you don't want with search/replace:
Search: ^5234534.*
Replace: (empty)
[x]Regular expressions
Followed by function to remove empty lines from menu Edit / Line manipulation

Options: Reply | Quote | Up ^


#3 Re: delete all lines not beginning with a predefined string

Posted by: Esgrimidor | Date: 01/20/2018 20:32 | IP: IP Logged

Thanks a lot !!!!!

Best Regards

--
Nice program indeed

Options: Reply | Quote | Up ^






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