I’m trying to write a bash script that takes a file name, and return lines that have one word. Here is sample text:
This has more than one word
There
is exactly one word in above line.
White-space
in the start of the above line doesn't matter.
Need-some-help.
Output:
There
White-space
Need-some-help.
I’m looking into using a combination SED and Regex.
Note: I cannot using anything else (it has to be a bash script, without custom modules), so suggesting that wouldn’t help.
If words can contain any non-whitespace characters, then:
or
or