[TxMt] Re: How to insert a letter/sign at the end of matching lines?

Brian H binarynomad at gmail.com
Thu Apr 7 01:25:51 UTC 2011


What if you first GREP for the lines with "cat=" and then pipe that to SED to replace the '{' and '}'


----
Brian H
binarynomad at gmail.com
http://www.binarynomad.com

On Apr 6, 2011, at 6:26 AM, Marius Hofert wrote:

> Dear textmate experts,
> 
> I have a text file with lines like this:
> 
> dog={brown, bark},
> cat={white, purr},
> mouse={gray, beep},
> 
> I would like to end up with this:
> 
> dog={brown, bark},
> cat={{white, purr}},
> mouse={gray, beep},
> 
> Replacing "cat={" by "cat={{" is trivial, but how can I replace the closing brace "}" by "}}" for that lines? I tried to work with regular expressions and ^.*cat={.*$ matches the lines starting with "cat={", but I couldn't manage to tell textmate's "Find" to basically add something to a line. I also seems to me that although the "Find"-box in textmate's "Find" can deal with regular expressions, the "Replace"-box ignores regular expressions. 
> 
> I know textmates "Edit Each Line in Selection", but I can't select all lines starting with "cat={" by hand, there are simply too many in my file. 
> 
> Cheers,
> 
> Marius 
> 
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate



More information about the textmate mailing list