In particular, the subset of global edit commands: g, v, s; the display
command: p; the editing command: d; and combinations of, e.g, g or v with s,
would be sufficient. For RE's, ^ start-of-line, end-of-line $, . single
char, * multiple char, [] character set, \{n\} count, and ASCII char's would
be sufficient.
Rod Pemberton
Wouldn't those be 'sub'? I.e., isn't there a difference between these two?
g/pat-1/s/pat-2/repl/
g/pat-1/s/pat-2/repl/g
> g/pat-1/d /pat-1/{next}{print}
>
> v/pat-1/d !/pat-1/{next}{print}
>
>
> But note that ex expressions can get even more complex, e.g.
>
> 5,8g/pat-1/s/pat-2/repl/ NR>=5 && NR<=8 && /pat-1/{
> gsub(/pat-2/,"repl")}{print}
>
> Or something that I currently won't even try to transform - though
> possible to do in principle
>
> /pat-1//pat-2/s/pat-3/repl/
>
>
> Maybe you can use the examples for something, or write a simple
> converter yourself; a lot of what you want may be covered by the
> examples and a generator seems to be straightforward to develop.
>
Thank you! Very informative. I appreciate that you worked out the
combinations - even if "untested". As long as the anchors (^,$) are the
same for AWK RE's, those will probably do. So, I might not need the
utility... But, I still think it might be interesting: ex2awk, awk2c,
dedicated executable that does customized editing and/or parsing... vi's
ubiquitousness means many people are familiar with ex commands, who might
not be familiar with awk.
RP
PS. I almost missed your reply though. You dropped the other ng's... I
was Googling NG's for related info and saw it. I was watching alt.lang.awk
but not through Google Groups. I added them back in case someone else was
reading the thread on them. I hope you don't mind.
There's some good stuff (including an awk <-> sed chart) on Eric
Pement's site (although it may not be exactly what you wanted):