Does awk have a syntax for a range of numbers or is this the best way?
if ($1 >= 0 && $1 <= 9 )
Does awk have a syntax for a range of numbers or is this the best way?
if ($1 >= 0 && $1 <= 9 )
Hi.
Awk uses regular expressions.
You could say
$1 ~ /^[0-9]$/ { ... }
or
if ( $1 ~ /^[0-9]$/ ) ....
exactly what I was looking for "proper syntax is such sweet sorrow". Thank you and congrats on Switzerland qualifying for the 2010 world cpu today !!
Hopp Schwiiz!
Usa usa usa !
/^[0-9].*/
n1djs thank you for your valuable input, its help me get further today, seems its one thing after another hoping to hit jack pot soon. Will post when I am done. Again thanks
Finally hit the jack pot. again thank you for your contribution which help me move forward along to my destination:
{
if (sub(/DISCOVERY=ON/, "DISCOVERY=OFF"))
print $0
if ( $1 ~ /^#/ ) {
print $0 }
if ( NF == 4 ){
if ( system("test -d " $4) ) {
}
else {
print "1 0 0 "$4 "\n" }
}
}
---------- Post updated at 06:03 PM ---------- Previous update was at 05:29 PM ----------
n1djs & scottn finally hit the jack pot. Again thank you for your contribution which help me move forward along to my destination:
{
if (sub(/DISCOVERY=ON/, "DISCOVERY=OFF"))
print $0
if ( $1 ~ /^#/ ) {
print $0 }
if ( NF == 4 ){
if ( system("test -d " $4) ) {
}
else {
print "1 0 0 "$4 "\n" }
}
}