Something to keep in mind, initially don't be afraid to make use of the "|"

cat data | sed  | awk | sed | awk | cut | sed | awk ....

once you get the results you want you can decide if you want to a reduction
into fewer pipes.

another thing many look over is instead of doing ... | sed '<sed command>'
| sed '<sed command'> | ...

is ... | sed '<sed command>;<sed command>; ...' |  ....

for me if it ends up being more the around 3 or 4 levels deep I use sed -f

I'll toss another in is to watch out for is regex limitations known as BRE
or Basic Regular Expressions in grep and sed, and older or non gnu
variations of awk.

if you really feel adventurous is to replace your use of grep, sed and awk
with perl 'one-liners' but if your havn't ventured into the perl it is
quite a big step.







On Wed, Jul 8, 2015 at 5:34 AM, Rich Shepard <rshep...@appl-ecosys.com>
wrote:

> On Tue, 7 Jul 2015, Rich Shepard wrote:
>
> >   I understand sub(), gsub(), and substr() but have difficulty figuring
> out
> > how to use any or all to modify a field's contents.
>
>    The light clicked on last evening that awk is the wrong tool for this
> job.
> The appopriate one is sed. After careful re-reading of the sed portion of
> the 15-year-old ORA sed & awk book I thought of a set of sed commands that
> will do all the insertions and deletions required.
>
>    Today I'll test until all cases are correctly handled. Will post the
> final
> sed script here for posterity.
>
> Rich
>
> _______________________________________________
> PLUG mailing list
> PLUG@lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
_______________________________________________
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to