Looking for a text editor that will allow me to start each line with tab or spaces, lines are already filled.

None-yet

Member
Credits
576
Not sure if this question should go here or in "General Linux topics " even though this would apply to all Linux I would think but since I am use Kali I decided to post here. If I should have posted somewhere else please move this to where it belongs.

I am looking for a text editor to easily work with my "beginner level" and decided to try Scite. I need something to open 5 to 10 gig files and it seemed to be worth a try.

I have looked in the options and searched around as to how I can put a "tab 0x09" in the front of all lines in a 500mb file. Reading some online it seems that Scite will not allow a line to start with a tab or a space. What I really need is to start each line with "admin " . I wasn't sure if it would allow this.

I use EditPad Lite 8 in Windows and it will let me put a white space in front of each line. I then can copy the white space into the search and replace field and then replace the white space with "admin " and that has worked pretty well. But was hoping to move totally to Kali for this kind of stuff.

My question is does anyone know and can explain how this may can be done in Scite or can someone suggest another text editor that I should look at for this function. I know if Editpad does this then there should be another editor out there that will do this.

Thank You!
 


JasKinasis

Well-Known Member
Credits
2,259
Rather than using a text editor - you could just use sed to do it instead:
Bash:
sed -i 's/^/\t/' /path/to/file
That simple one-liner will insert a tab character on every single line in the file. With no need to open an editor and get your hands dirty.
 

JasKinasis

Well-Known Member
Credits
2,259
Alternatively you could use vim.

In vim, you can easily record a macro that inserts a tab at the start of the current line and then moves the cursor to the next line. Then you can repeat the macro as many times as you like! And macros persist across sessions until you remove the macro, or overwrite its register with something else.

If you aren't familiar with vim - you might want to try out the vimtutor command to learn some of the basics of vim. Vim is a modal editor and is unlike any other editor you've used. But you can be insanely productive using it (once you've learnt how to use it!). When it comes to text editing, vim is a veritable powerhouse!

There is one other minor caveat when dealing with excessively large files in vim - you sometimes need to consider splitting the file into smaller chunks using the splitfile command in the terminal. Then you can open up the chunks to perform your edits. And after you've edited all of the chunks, you can use the cat command to join all of the chunks back into a single file again.

So if your file has been split into 4 chunks called file01, file02, file03, file04 - after editing the chunks - you can join them back together using something like the cat command:
Bash:
cat file0{1,2,3,4} > file
I've been using vim for many years and am extremely proficient with it. So if you decide to try vim and you need help working out how to create a macro to insert a tab on every line, give me a shout.

However, for a job like this, where you're applying edits wholesale to a file - I'd completely forego a text editor and simply use sed instead. As per my previous post.
 
Last edited:


Members online


Latest posts

Top