Source: http://unix.stackexchange.com/questions/84922/extract-a-part-of-one-line-from-a-file-with-sed

Imagine you have a text:

How do we extract the first number (number of animal) and the second number (number of singers). Notice that there is no pattern. so we have to tell sed literally get us the first set of numbers you encounter and the second.

So to extract the first number you would do this:

The second numbers:

The third set of numbers (which only appears once on the third line):

Output of all 3 runs:

The end.

Leave a Reply

Your email address will not be published. Required fields are marked *