Your problem is incorrect so there is no sol'n.

        printf 'abc def' | grep -o '^[a-z]'

is only supposed to match against abc.

see grep(1) about pattern matching - there is plenty of online writeups, esp posix ieee std. see also "ant / antlr" for more about patterns and matching.

Jim Pryor wrote:
The following reply was made to PR bin/166842; it has been noted by GNATS.
From: Jim Pryor <[email protected]>
 $ printf 'abc def' | grep -o '^[a-z]'
 will match against each of the letters in 'abc', but not against any of
 the letters in 'def'.
 [email protected]

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to