[TxMt] Re: Inserting a special char at beginning and end of multiple lines?

Rob McBroom mailinglist0 at skurfer.com
Wed Nov 9 20:14:48 UTC 2011


On Nov 9, 2011, at 3:05 PM, Adam Boettiger wrote:

> What I don't know and what I can't locate in the manual document is
> how to select all 20,000 lines and insert a character at the beginning
> and end of each of those lines.

You can add to the beginning of each line by selecting all but the last one (be sure to include the newline at the end of the second-to-last line) then hitting ⌥ to change it to a column selection. You should have a 0 column wide selection at the beginning. Anything you type will appear on every line.

To add to the end, just select all the lines and hit ⌥⌘A.

> What is the most efficient way of doing this?

The above is probably not a good idea with 20,000 lines. For that I would use Find & Replace with a regular expression. Check the “Regular expression” box in the Find panel, then

Find: ^(.*)$
Replace: ADD TO BEGINNING$1ADD TO END

That is, $1 will be replaced with the original line. Whatever you type around it will be added.

-- 
Rob McBroom
<http://www.skurfer.com/>



More information about the textmate mailing list