[Tfug] OK, I need one more funky little sed or bash code...

Claude Rubinson rubinson at u.arizona.edu
Sat Mar 27 12:02:37 MST 2010


On Sat, Mar 27, 2010 at 12:17:23AM -0700, Jim March wrote:
> I need to find every line that ends with a "{" character and put a
> new line right above it, exactly like this:

Jim --

Do yourself a favor and pick up a copy of O'Reilly's /sed & awk/.  $13
plus shipping for a used one at Amazon.  They're little languages
designed for precisely what you're trying to do.  In the meanwhile,
the beginning of line anchor is ^ and the end-of-line anchor is $, so
start out with something like:
    $ awk '/{$/{print}' filename
and work from there.

Claude




More information about the tfug mailing list