On Thu, 07 Dec 2006 23:29, Ross Drummond wrote:

> Here is how I would do it;
>
> echo '<span id="lblValuationNumber">22115 36400 B</span></td>' |
> cut -d '<' -f 2 | cut -d '>' -f 1
>
> Note, the command is one line. I have split it to escape the line wrap
> gremlins.

I have made an error in the above command.

I have got the less than, and greater than, around the wrong way. It was late 
at night mumble mumble.... Here is the corrected version;

echo '<span id="lblValuationNumber">22115 36400 B</span></td>' |
cut -d '>' -f 2 | cut -d '<' -f 1

The plain language explanation is;

Feed the string to the 1st instance of cut using echo and a pipe,

Use cut to slice the string into several separate strings using > as a 
delimiter, and discard all of the separate strings except the 1st field,

Pipe the resulting output to the 2nd instance of cut and here use < as the 
delimeter and retain the 1st field to trim the unwanted text from the tail.

Cheers Ross Drummond

Reply via email to