skymario84
skymario84

Reputation: 123

Find and print a regex with sed, awk, perl

i can't seem to find a way to take something like this:

some name blah blah blah:12000 some numbers 3746 4857 23490 324989 and in 
the end THIS 3456/45678

IT'S NOT ALWAYS IN THE END, COULD BE ANYWHERE IN A LINE...

So, in one line there are a lot of numbers and everything else, and I need to extract only this:

Output:

3456/45678

I have tried, SED, AWK...and everything i tried succesfully extracts all the numbers, but I need only that pattern...

Has anyone any ideas?

Thanks to all in advance...

Upvotes: 2

Views: 68

Answers (1)

anubhava
anubhava

Reputation: 785721

Using egrep:

egrep -o '[0-9]+/[0-9]+' <<< "$s"
3456/45678

Upvotes: 2

Related Questions