Tuesday, May 18, 2010

grep ? (regex)


from grep info. GNU FDL



`?' The preceding item is optional and will be matched at most once.



$cat bu.txt
bugy
buggy
bugggy
$

$grep -E bug\?y bu.txt
bugy
$grep -E bugg\?y bu.txt
bugy
buggy
$grep -E buggg\?y bu.txt
buggy
bugggy
$