I have 20,000+ lines that I need to select-all and then be able to insert a special character like ^ not normally found within the document, at the beginning of every line, to allow me to then use Find and Replace to insert a common string at the beginning of each line.
After doing this, I also need to be able to do the same thing at the END of each line of text and run find and replace with a different string on all 20,000 lines.
I know how to use Find & Replace.
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.
What is the most efficient way of doing this?
Thanks in advance for any help!
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 -
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@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@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@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On Nov 10, 2011, at 4:25 AM, Adam Boettiger wrote:
Thank you for your prompt reply to my question. Are you the developer of TextMate?
Oh, no. Just a long time user. Although it’s not uncommon to get answers direct from the developer (Allan Odgaard) on this list.
I looked at your personal site and I must say that I am impressed with your background and pleased to make your acquaintance!
Thanks.
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.
Glad it helped. I do that all the time.