Reply to topic

How to select multiple lines by number on Kate?

User avatar Xeno_Idaltu
Registered Member
Posts
10
Karma
0
OS
The command "locate lmms" on the terminal gave me a lot of output, therefore I had to save the output in a file.

I opened the file on Kate and there are 4,640 lines of code.

How can I select all lines from 2-2,633?
Once I have them selected I can delete them and concentrate on the other lines.
airdrik
Registered Member
Posts
1854
Karma
5
OS
First you should be able to just scroll to the start location (or use ctrl+g to go to a specific line) and use shift+up/down/pageup/pagedown/etc or shift-mouse-click to select the couple-hundred line chunk you want to remove and then hit delete. (I don't know of any keyboard shortcut to select from here to another specific line number; but I assume you were already scrolling around the file to figure out the start and end lines you wanted to remove).

If there's a common sub-string in the lines you want to remove, you can use kate's regex-based find-and-replace to remove those lines. In the dialog, ensure Mode is set to Regular expression, then in the Find box you can use a find expression like: .*commonText.*\n to find all lines which contain 'commonText', then (with an empty Replace field) hitting Replace All should remove all of them (the ".*" bit is a wild-card expression that matches anything except new-lines) (If you right-click in the Find box, there's an Add menu which shows the other regex elements you can add to the search criteria).


airdrik, proud to be a member of KDE forums since 2008-Dec.
User avatar pvzh
Registered Member
Posts
14
Karma
0
OS
If you have to cut lines often, you can try using a sed:
Code: Select all
locate lmms | sed -n '2,2633!p' > concentrate.txt

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], koffeinfriedhof, Majestic-12 [Bot], mouse, plistov, reevz, smankowski, Sogou [Bot]