by "flatten the whitespace" do you mean turning many spaces into one space? If so, I have always used tr with the -s (squeeze) option for that:
$ echo "one two three" | tr -s " " | cut -d " " -f 3 three
by "flatten the whitespace" do you mean turning many spaces into one space? If so, I have always used tr with the -s (squeeze) option for that: