The pattern \d
might not be supported by your sed
. Try [0-9]
or [[:digit:]]
instead.
To only print the actual match (not the entire matching line), use a substitution.
sed -n 's/.*\([0-9][0-9]*G[0-9][0-9]*\).*/\1/p'
More Related Contents:
- RE error: illegal byte sequence on Mac OS X
- Why is sed not recognizing \t as a tab?
- Insert linefeed in sed (Mac OS X)
- Replace a word with multiple lines using sed?
- replace a unknown string between two known strings with sed
- How to change date format in sed?
- Non greedy (reluctant) regex matching in sed?
- How can I output only captured groups with sed?
- How do I use regular expressions in bash scripts?
- Check if a string matches a regex in Bash script
- Insert contents of a file after specific pattern match
- Using sed to delete all lines between two matching patterns
- Using the star sign in grep
- How to extract string following a pattern with grep, regex or perl [duplicate]
- Extract substring using regexp in plain bash
- How do you extract IP addresses from files using a regex in a linux shell?
- Bash, grep between two lines with specified string
- Search and replace in bash using regular expressions
- Fully qualified domain name validation
- What’s wrong with my lookahead regex in GNU sed?
- How can I insert a tab character with sed on OS X?
- How do I use a regex in a shell script?
- Easiest way to extract the urls from an html page using sed or awk only
- Sed to extract text between two strings
- Recursively change file extensions in Bash
- How do I use a new-line replacement in a BSD sed?
- Why does BASH_REMATCH not work for a quoted regular expression?
- Replace all whitespace with a line break/paragraph mark to make a word list
- Grep and regex – why am I escaping curly braces?
- Bash – Regex for HTML contents