You are here: PSPad forum > English discussion forum > Insert Text into lines

Insert Text into lines

#1 Insert Text into lines

Posted by: Anonymous User | Date: 2013-08-08 07:34 | IP: IP Logged

Hi. I know I can Insert Text into lines... (Alt+I), but how do I delete text from lines? And if this is not possible, can it be implemented in PSPad, in a similar manner?

Edited 1 time(s). Last edit at 2013-08-08 07:34 by Skulstad.

Options: Reply | Quote | Up ^


#2 Re: Insert Text into lines

Posted by: vbr | Date: 2013-08-08 08:50 | IP: IP Logged

Skulstad:
Hi. I know I can Insert Text into lines... (Alt+I), but how do I delete text from lines? And if this is not possible, can it be implemented in PSPad, in a similar manner?

Hi,
if you just need to delete a kind of text rectangle (a segment of characters from multiple lines), you can just use block selection and delete it.

To activate block selection (in standard setting), you can press [Alt] and make a normal select with the mouse.

If there is a larger portion of text to be handled this way, you can change the selection mode in the menu:
Edit: Selection type: Column selection
or click repeatedly in the respective icon in the statusbar (3rd from the left).
move the cursor to the planned beginning of the block, press F8 [toggle selection], move to the end of the selection and press F8 again.

hth,
vbr

Options: Reply | Quote | Up ^


#3 Re: Insert Text into lines

Posted by: Anonymous User | Date: 2013-08-08 10:12 | IP: IP Logged

Hi and thanks.

I have a number of files with 20000+ lines, thus none of your suggestions will work (satisfactory).

- The first one is too time-consuming
- Number two doesn't work for me: I set the selection type to column selection, press F8, then F8 again, and selection type goes automatically back to normal, and EVERYTHING between the two F8s is selected.

Options: Reply | Quote | Up ^


#4 Re: Insert Text into lines

Posted by: vbr | Date: 2013-08-08 11:40 | IP: IP Logged

Skulstad:
Hi and thanks.

I have a number of files with 20000+ lines, thus none of your suggestions will work (satisfactory).

- The first one is too time-consuming
- Number two doesn't work for me: I set the selection type to column selection, press F8, then F8 again, and selection type goes automatically back to normal, and EVERYTHING between the two F8s is selected.

Hi,
you can change the selection type afterwards again, the selection limits should remain until you move the cursor; maybe it's more useful in different order then - set start-stop of the selection with F8 and set column mode.

hth,
vbr

Options: Reply | Quote | Up ^


#5 Re: Insert Text into lines

Posted by: pspad | Date: 2013-08-08 12:39 | IP: IP Logged

Hello
You can use regular expressions in search/replace
e.g. you want to remove first 6 chars from each line:

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

Options: Reply | Quote | Up ^


#6 Re: Insert Text into lines

Posted by: Anonymous User | Date: 2013-08-09 05:34 | IP: IP Logged

Hi. I think your suggestion works. Being a novice in regular expressions, how do I remove characters 12 to 20?

Options: Reply | Quote | Up ^


#7 Re: Insert Text into lines

Posted by: pspad | Date: 2013-08-09 08:10 | IP: IP Logged

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

Expression in round bracket are indexed and can be used in replace with $n
^begin of the line
. means any char
{min,max} - number of previous epressions occurence
* means any count of previous epression

So i search first 11 chars, then 9 and rest of the line
replace with first and third part (exclude the middle part)

Options: Reply | Quote | Up ^


#8 Re: Insert Text into lines

Posted by: Anonymous User | Date: 2013-08-09 08:58 | IP: IP Logged

Thank you! Works perfectly!

Options: Reply | Quote | Up ^


#9 Re: Insert Text into lines

Posted by: Stefan | Date: 2013-08-11 13:58 | IP: IP Logged

pspad:
search: ^(.{11,11}).{9,9}(.*)
replace: $1$2
[x]Regular expressions

Expression in round bracket are indexed and can be used in replace with $n
^begin of the line
. means any char
{min,max} - number of previous epressions occurence
* means any count of previous epression

So i search first 11 chars, then 9 and rest of the line
replace with first and third part (exclude the middle part)

{digit} - exactly amount of previous epressions occurence

search: ^(.{11}).{9}(.*)
replace: $1$2
[x]Regular expressions

.

.

.

There is also:
{min,} - min number of previous epressions occurence, up to as many as there is.
{,max} - zero or more, up to max number of previous epressions occurence.

The already mentioned:
{min,max} - at least min, up to max number of previous epressions occurence
{digit} - exactly amount of previous epressions occurence

.

.

.

--
Stefan (pleased user since 1722)
Do you know you can spend Jan a beer? (click here)
Inofficial FAQs + Infos + Special Settings

Edited 1 time(s). Last edit at 2013-08-11 14:01 by Stefan.

Options: Reply | Quote | Up ^






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