I am tring to create a script with a dynamic regex however awk doesn't seem to like comparing a variable to a regex stored in a variable. For example:
regex = "/^abc/"
if ( $0 ~ regex ) {
print 1
} else {
print 0
}
Whether or not the if condition is true or not the script always returns false is there something I'm missing.
Thanks
regex = "/^abc/"
if ( $0 ~ regex ) {
print 1
} else {
print 0
}
Whether or not the if condition is true or not the script always returns false is there something I'm missing.
Thanks