Re: [DNG] Awkishness [Was: Re: Steam, Mumble, Valheim, Alsa and shared audio

2021-08-31 Thread hal


On 8/24/21 00:25, dva...@internode.on.net wrote:

   I hope that interests someone. It's not often that an opportunity
   to espouse the original text Swiss army knife presents itself.


It is, thanks for the awk info!

I first encountered awk on Solaris in the late 90s in a mixed environment of 
Linux, AIX and Solaris. I believe this is where the tic in my left eyelid comes 
from. Trying to keep scripts portable between those three systems tuned my 
shell-fu in ways which are not efficient. I'm afraid my bad habits are still 
there but I *will* take credit for getting out of the habit of piping cats :D

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Awkishness [Was: Re: Steam, Mumble, Valheim, Alsa and shared audio

2021-08-24 Thread Martin Steigerwald
Dear Erik,

dva...@internode.on.net - 24.08.21, 07:25:07 CEST:
>I hope that interests someone. It's not often that an
> opportunity  to espouse the original text Swiss army knife presents
> itself.

Thanks!

Nice one.

Best,
-- 
Martin


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


[DNG] Awkishness [Was: Re: Steam, Mumble, Valheim, Alsa and shared audio

2021-08-23 Thread dvalin

  On 02.07.21 10:58, hal wrote:
  
  >
  > $ dpkg -l | egrep -i '(alsa|pulse)' | awk '{print $1"  "$2};'
  > ii  alsa-utils
  > ii  apulse:amd64
  ..
  
   
  Granted, the egrep as quick to use if that's what one's typing
  fingers remember, and day to day, it's only the results which
matter
  a damn. But as an aside, is it maybe generically helpful to hint
  that awk is a complete text processing language; one that it is
  not often fully utilised these days? It'll do it all:
 
 
  $ dpkg -l | awk -v IGNORECASE=1 '/alsa|pulse/ {print $1"  "$2};'
  ii  alsa-utils
  ii  debian-pulseaudio-config-override
  ii  gstreamer1.0-alsa:i386
  ii  gstreamer1.0-pulseaudio:i386

   
  That its great strength is grepping, via the "/pattern/ {action}"
  behaviour, is perhaps clearer for the casual reader when we don't
  stop to ignore case: 
  
  $ dpkg -l | awk '/alsa|pulse/ {print $1"  "$2};'
  ii  alsa-utils
  ii  debian-pulseaudio-config-override
  ii  gstreamer1.0-alsa:i386
  ii  gstreamer1.0-pulseaudio:i386

  As for egrep (over plain grep), "The regular expressions in awk 
are a superset of the POSIX specification for Extended Regular 
  Expressions (EREs). POSIX EREs are based on the regular 
expressions accepted by the traditional egrep utility.", quoting  the
"GAWK: Effective AWK Programming" pdf.
  Incidentally, I found the mawk variant was awk on my beowulf 
install. As I prefer to take advantage of a few enhancements 
  provided by gawk (GNU Awk), I've done a quick:  # apt-get install
gawk
   I hope that interests someone. It's not often that an
opportunity  to espouse the original text Swiss army knife presents
itself. 

  Erik


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng