Re: script help with grep or regex ?
| Newsgroups | gmane.org.user-groups.slug.general |
|---|---|
| Message-ID | <84sisq55fe.wl%[email protected]> |
>>>>> "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