Please use ***
[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do
not use quote tags, bolding, colors, "start/end" lines, or other creative techniques.
They will also allow you to insert literal tabs and spaces into the text.
Here's a more compact
grep for you (actually
egrep, since it needs extended regex):
Code:
grep -E '^\s*(\w|[[:punct:]])+\s*$'
\s is a built-in synonym for
[[:space:]], and
\w is a synonym for
[[:alnum:]_].
(a|b) is a regex either-or grouping, and finally
* means "
0 or more" and
+ is "
1 or more".
So this line means any amount of whitespace, followed by a string of one or more word characters and/or punctuation characters, followed by more optional whitespace.
See the
regular expressions section of
info grep for more on how character classes and backslash characters are defined.