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

Adam Boettiger adam at adamboettiger.com
Thu Nov 10 09:25:08 UTC 2011


Rob -

Thank you for your prompt reply to my question. Are you the developer
of TextMate?

I looked at your personal site and I must say that I am impressed with
your background and pleased to make your acquaintance!

What you recommended worked flawlessly. I would have never known how
to do that but it is invaluable information and I thank you for
providing it.

Adam Boettiger

adam at adamboettiger.com - 503.616.8968

http://adamboettiger.com/ - Bio
http://digitalminimalism.com/ - Blog
http://twitter.com/adamboettiger - Tweets on digital marketing
http://twitter.com/minimalism - Tweets on productivity, attention,
focus, email overload


On Wed, Nov 9, 2011 at 12:14 PM, Rob McBroom <mailinglist0 at skurfer.com> wrote:
> 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/>
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate



-- 
Adam Boettiger
adam at adamboettiger.com - 503.616.8968
Portland, Oregon

I check email a couple times daily; to reach me sooner, please call me
or click here: https://awayfind.com/adamboettiger


More information about the textmate mailing list