Hi,
or in perl :)
If there is other data in front
| perl -ne 'if (<> =~ /(?<!\w)(313[0-9]{4})(?![0-9])/) { print "$1\n";}'
otherwise
| perl -ne 'print if /^313[0-9]{4}(?![0-9])/'
On 15 January 2014 13:45, <[email protected]> wrote:
> >>>>> "lists" == lists <[email protected]> writes:
>
> lists> I have a shell script that gets a web page, after around half
> lists> dozen sed/awk one liners I end up with like[1]:
>
> lists> I would like to extract all the 7 digit numeric values,
> lists> currently starting with '313....', to use them further in the
> lists> script
>
> Why not just something like:
> sed 's/[^0-9]*\(313[0-9][0-9][0-9][0-9]\)[^0-9]*/\n\1\n/g' |
> sed -n '/^313[0-9][0-9][0-9][0-9]$/p'
>
> This first splits out 7-digit numbers starting 313 into a line on
> their own, then prints just those lines.
>
> Peter C
> --
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
>
--
Darragh Bailey
"Nothing is foolproof to a sufficiently talented fool"
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html