I want to print everything after the first whitespace. E.g. given hello there I want to print hello there, given what's up I want to print what's up.
I wrote this fully expecting it to work:
{ print $0 }
match($0, /[^[:space:]].*$/) {
print $1
}
I thought the regex /[^[:space:]].*$/ would match the first non-space character, and then .*$ would match all of the characters after it.
But the regex only seems to capture up to the next whitespace:
$ echo hello there | awk -f after_indent.awk
hello there
hello
$1is globally considered as the first field, it's not the match result. You have to usesubstrto get the match result: