grep -o ^....

2016-08-24 Thread Ted Unangst
per freebsd bug report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201650 echo "1234 1234 1234" | grep -o ^ 1234 Index: util.c === RCS file: /cvs/src/usr.bin/grep/util.c,v retrieving revision 1.55 diff -u

grep -o

2011-06-20 Thread Ted Unangst
this was proposed a while ago, but got sidetracked by some nonstandard option discussion. bringing it back in slightly different form. -o only prints the matching parts of a line, not the entire line. While this is possible using awk, the same could be said of everything grep does. It is