Cara memilih ribuan garis


5

Saya memiliki file teks dengan 200.000 baris. Bagaimana cara memilih beberapa baris, sebelum saya menghapusnya?

Pekerjaan manual terlalu sulit untuk, katakanlah, 65.000 baris.


4
pilih mereka dengan kriteria apa? Anda akan lebih beruntung menggunakan regex atau semacamnya, tetapi tanpa informasi lebih lanjut sulit untuk memberikan jawaban yang spesifik dan berguna
— Journeyman Geek

1
Garis kontinu atau terpisah?
— The_aLiEn

Pilih CTRL + mouse dapat melakukan sesuatu seperti apa yang ingin Anda lakukan.
— Diogo

7
Klik pada garis awal, gulir ke bawah ke garis akhir, tahan tombol shift, dan klik lagi.
— Daniel R Hicks

IYA NIH ! Tangkap Anda, kunci shift adalah solusinya !!
— Sandra

Jawaban:



1

The shift+ some direction controlcombo cukup terkutuk lambat untuk ribuan baris / halaman; jadi inilah solusi cepat ...

# File:: selectGOTO.py
#   A N++ Python Script to enhance line selection speed compared to mouse, cursor, page controls.
#   Selects text from the [ start|end ] of current line to [ end|start ] of GOTO line.

# Install using:: Plugins -> Plugin Manager -> Python Script
# Create script using:: Plugins -> Python Script -> New Script -> "selectGoto.py"
# Add to menu:: Plugins -> Python Script -> Configuration -> [select script] [ add ]
# Create shortcut:: [Restart N++]
#   Settings -> Shortcut Mapper -> Plugin Commands -> selectGOTO -> [modify] [ctrl]+[shift]+[g]

# Simple usage:
#   [ctrl]+[shift]+[g] line#
#   Do your operation... (ie: del)

from Npp import *

class startAnchor:
    pos = 0

def selectGOTO( args ):
    endPos = editor.getCurrentPos()
    if( endPos > startAnchor.pos ):
        startAnchor.pos = editor.positionFromLine( editor.lineFromPosition( startAnchor.pos ) )
    else:
        tmp = startAnchor.pos
        startAnchor.pos = endPos
        endPos = tmp
    endPos = editor.getLineEndPosition( editor.lineFromPosition( endPos ) )
    editor.setSel( startAnchor.pos, endPos )
    editor.clearCallbacks()

def main():
    startAnchor.pos = editor.getCurrentPos()
    editor.callback( selectGOTO, [SCINTILLANOTIFICATION.UPDATEUI] )
    notepad.menuCommand( MENUCOMMAND.SEARCH_GOTOLINE )

main()

0

Memegang Shift dan PageDown dapat memilih banyak garis dengan cukup cepat.


Ctrl + A memilih semua yang ada di dokumen. Pertanyaan ini adalah tentang memilih beberapa baris, bukan keseluruhan dokumen.
— codingfanatic
Dengan menggunakan situs kami, Anda mengakui telah membaca dan memahami Kebijakan Cookie dan Kebijakan Privasi kami.
Licensed under cc by-sa 3.0 with attribution required.