text-editing interview questions
Top text-editing frequently asked interview questions
For example, if I have four lines as follows:
the first line
the second line
the third line
the fourth line
I want to reverse them to
the fourth line
the third line
the second line
the first line
How could I do this in vim?
Source: (StackOverflow)
I want to write multi-lines in one MS Excel cell.
But whenever I press the Enter
key, the cell editing ends and the cursor moves to next cell. How can I avoid this?
Source: (StackOverflow)
I want to filter a file I'm editing in Sublime Text 2 for lines contain a certain string, if possible including regular expressions.
Consider the following file:
foo bar
baz
qux
quuux baz
When filtered for ba
, the result should be:
foo bar
baz
quuux baz
How can I do that?
Source: (StackOverflow)
I recently moved back to Windows from Linux. I have some files with CRLFs, some with LFs and some that are mixed. Is there a utility that will help me find all my Unix-touched files and convert them to proper CRLF terminated files?
EDIT: The utility must run on Windows, not Linux. I have already moved. I'd rather not install Cygwin if I can avoid it.
Source: (StackOverflow)
Sometimes I edit English text that includes Unicode characters. For some reason, on my PC, Notepad++ converts Unicode characters to ???'s thereby corrupting the text and losing all that data. I'm looking for a way to edit such text, while preserving Unicode characters. I'm using Consolas as my Font. If the font doesn't have all those characters, why should I lose the data when I copy the text out of Notepad++ (via Windows' clipboard)?
Source: (StackOverflow)
By default, the cut/copy/paste short-cuts in GVim on Ubuntu are:
Cut "+x
Copy "+y
Paste "+gP
I would like to use control key combos in GVim, like I use in Firefox and othe gnome applications. How do I configure GVim to work like other Gnome apps?
Source: (StackOverflow)
I have a list of about 10,000 name/addresses that I have to manually cleanse in Excel (fun!). As you can imagine, having to double click to enter almost every cell to edit it is a drag. And it's frustrating that if you are even slightly near the top/bottom of the cell, you end up at the top/bottom of the worksheet!
Is there a way of telling Excel to stay in 'edit mode', so that when I click on a cell (or better yet, scroll down to it), it automatically allows me to edit the content? I can't just start typing, as that overwrite the whole cell, when often times I just need to edit 1 or 2 characters. Thanks.
Source: (StackOverflow)
Often when editing code, I'll select a block in visual mode and do a search and replace over the block. After I make the changes, however, it leaves visual mode. How do you do a new find and replace over the same selection?
Source: (StackOverflow)
How do I replace the string "\r\n" with the same characters?
Example:
Hello World.\r\nHello World.
replaced with:
Hello World.
Hello World.
Source: (StackOverflow)
I have questions about turn off parenthesis matching. Does anyone know how to turn off parenthesis matching?
example:
When I type a (
, it will automatically add )
, becomes ()
.
It's pretty nice for editing plain text. But quite annoying while editing clojure files.
Source: (StackOverflow)
I would like to open the file foo.bar
twice (or more) in emacs, so I can edit two different parts of it simultaneously. Is it possible? Probably the better question is, how to do it? Is there a way to open each instance in its own buffer/frame?
Source: (StackOverflow)
Is there a tool to split large text file (9Gb) into smaller files so that I can open it and look through?
Anything usable from command line that comes with Windows (XP)?
Or what's the best way to split it? Can I use 7z to create separate volumes and then unzip one of them separately? Will it be readable or does it need all the other parts to unzip into the big file again?
Update
I put together quick 48 lines python script that split the large file into 0.5GB files which are easy to open even in vim. I've just needed to look through data towards the last part of the log (yes it is a log file). Each record is split across multiple lines so grep would not do.
Source: (StackOverflow)
If I copy data in Excel and paste it in a text file, I get tabs between cells. That's not good, I want spaces - and I want the columns to be aligned. How can I achieve this without a lot of effort (obviously I don't want to start running regexps by hand etc.)
Using 'Save As' (as in this question) is not a solution for me, I need copying and pasting.
Source: (StackOverflow)