Make gawk line work in mawk
Thanks for helping thick headed people like me.
I have a line in a script that works fine in gawk but fresh installs of debian based systems come with mawk instead. On a desktop or laptop that is not an issue really because storage space and cpu power are plentiful. But I wish to use this script on a Pi where storage space and cpu power are in limited supply. So I would like to change this line to work with mawk, and gawk if possible. Code:
BLOCKHEAD=$(awk "/\y${data[1]}\y/ {print FNR}" $TMPDIR/tempfile1b) Code:
+ w3m -dump -T text/html /home/kingbee/bin/shabbat/data/JPS/et0125.htm Code:
+ w3m -dump -T text/html /home/rbees/bin/shabbat/data/JPS/et0125.htm gawk on Desktop GNU Awk 4.1.4, API: 1.1 (GNU MPFR 3.1.5, GNU MP 6.1.2) Copyright (C) 1989, 1991-2016 Free Software Foundation. From what I have read if the versions of mawk and gawk are the same then they are compatible but clearly my versions are not the same. The desktop is running Wheezy (stable) the pi is running raspbian wheezy. So is it doable or should I just install gawk? Note: there are other lines in the script that may fail when conditions hit them but at this point I am not aware of them. Thanks again for your time. |
I don't have mawk on my system, but
Code:
\y Code:
\B, \<, \>, \s, \S, \w, \W, \`, and \' |
Try the more commonly supported \< and \> word boundaries:
Code:
BLOCKHEAD=$(awk "/\<${data[1]}\>/ {print FNR}" $TMPDIR/tempfile1b) |
Thanks lougavulin and MadeInGermany
You gave me what I needed to look for in the man. Comparing what the script actually dose, not that I really remember why, there are extensive changes that have to be made for it to actually work with mawk. That will require to much work that is beyond my programming ability and so will take a lot of time that I can better use for other more important things. So I install gawk Thanks again Linux Question users |
All times are GMT -5. The time now is 05:44 AM. |