Notepad++: Mark Column until End of File

2019-03-06 03:42发布

问题:

It's a simple question, I searched in google but didn't find anything helpful.

I know about the column mode in Notepad++ (Alt + Left mouse click or by using arrows). This is OK if I have only some columns, but I have a file wit about 10 000 lines and I would like to say to notepad mark the specific column until end of file.

How to do this?

The file looks like:

0       2942843527  0               1   Fr  0x237   3   00 00 10 02 00 00 00 
1       2942843813  286             1   Fr  0x237   3   45 1C 90 33 EA 75 29 7B 
2       2942844067  254             1   Fr  0x237   3   D4 8C 96 2C 01 FD 27 B7 
3       2942844321  254             1   Fr  0x237   3   34 2C FC F2 DD 31 69 76 
4       2942844575  254             1   Fr  0x237   3   91 8C AC 59 02 FD 67 EE 
5       2942844837  262             1   Fr  0x237   3   D9 3C 68 72 D1 E9 A8 71 
6       2942845100  263             1   Fr  0x237   3   D8 8C C3 FE 03 FD 67 FE 
7       2942845345  245             1   Fr  0x210   3   97 4C D4 31 C5 A5 C8 6C 
8       2942845599  254             1   Fr  0x290   3   87 8C D9 FE 04 FD 67 FE 
9       2942845845  246             1   Fr  0x290   3   A1 5C D0 B2 DB 69 A9 73 

So now I would like to select the complete second "column" until end of the file and then either delete it or copy to other file. I would like to be able to "mark" without using a script because this task will be done just once (for my own experiment)

回答1:

You are almost there, but add some scrolling on the scroll bar.

  1. Place your text cursor to top left corner of the column.

  2. In scroll bar on right side, drag the thumb to scroll to other end of the file.

  3. Alt + Shift + Left-click into the bottom right corner of your intended selection.

  4. Optionally, use Alt + Shift + arrows to adjust your selection as needed.



回答2:

  • Ctrl+H
  • Find what: ^\d+\h+(\d+).+$
  • Replace with: $1
  • check Wrap around
  • check Regular expression
  • DO NOT CHECK . matches newline
  • Replace all

Explanation:

^       : begining of line
  \d+   : 1 or more digits
  \h+   : 1 or more horizontal spaces
  (\d+) : group 1, 1 or more digits
  .+    : 1 or more any character
$       : end of line

Replacement:

$1      : content of group 1 (ie the second column)

Result for given example:

2942843527
2942843813
2942844067
2942844321
2942844575
2942844837
2942845100
2942845345
2942845599
2942845845


回答3:

Another way, you can try the plugin ConyEdit.
To copy to other file, use the command line cc.gc 2w.
To delete, use the command line cc.dc 2w.
Explanation:

gc: get column
dc: delete column
2w: second Word  

If it is more complex, you can try cc.gc <nth>/<regex>/



标签: notepad++