SyntaxFix
Write A Post
Hire A Developer
Questions
Try using rextract. It will let you extract text using a regular expression and reformat it.
Example:
$ echo "This is 02G05 a test string 20-Jul-2012" | ./rextract '([\d]+G[\d]+)' '${1}' 2G05