On Sat, 2017-07-15 at 09:59 -0700, Ian Zimmerman wrote: > On 2017-07-15 11:59, Antony Stone wrote: > > > Maybe other people have further optimisations. > > With awk already part of the pipeline, all those seds are screaming > for > a vacation. > Indeed. I think the whole job can be done fairly easily with a single awk script. I didn't look at the input (have parts of it appeared on this list?), which makes it hard to work out what the entire pipeline does. However, the more I look at it the more it looks as if awk's default action of chopping each line into words would, when combined with awk functions that use regexes to modify words - gsub() and friends - should simplify the whole exercise.
To the OP: if you want to raise your game with using sed and awk, about the best thing yo can do is to get the O'Reilly "sed & awk" book by Dale Dougherty - its a real eye-opener and much easier to read and understand than the manpages, if only because its better organised and includes a lot of example code. Martin