<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">I have 20,000+ lines that I need to select-all and then be able to<br></span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">insert a special character like ^ not normally found within the<br>
</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">document, at the beginning of every line, to allow me to then use Find<br></span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">and Replace to insert a common string at the beginning of each line.</span><br style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">After doing this, I also need to be able to do the same thing at the<br></span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">END of each line of text and run find and replace with a different<br>
</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">string on all 20,000 lines.</span><br style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">What is the most efficient way of doing this?</span></blockquote><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); "><br>
</span></div><div><font class="Apple-style-span" face="arial, sans-serif">I think using sed might be more efficient since TextMate's handling of large files can be a little unreliable sometimes.  Press option+command+r to bring up the Filter Through Command dialog and put this in the Command input box: </font></div>
<div><br></div><div>sed -e "s/^/\^/" -e "s/$/\^/"</div><div><br></div><div>That is, substitute a literal ^ (\^) for a beginning-of-line (^), and do the same for end-of-line ($).</div><div><br></div><div>
That might be faster than the Find and Replace dialog on a big file.  You can also store it as a command if you end up doing it a lot.</div><div><br></div><div>I hope that helps,</div><div>Brandon</div>