Need to extract characters between two search words in a script!!

Hi,

I have a log file which is the output from a xml script :

<?xml version="1.0" ?>
<!DOCTYPE svc_result SYSTEM "MLP_SVC_RESULT_320.DTD">
  <svc_result ver="3.2.0">
    <slia ver="3.0.0">
      <pos>
        <msid type="MSISDN" enc="ASC">8093078040</msid>
        <poserr>
          <result resid="5">ABSENT SUBSCRIBER</result>
          <add_info>Country Code: 1  Country Id: DOM</add_info>
          <time utc_off="-0400">20150416233219</time>
        </poserr>
        <gsm_net_param>
          <neid>
            <vmscid>
              <cc>1</cc>
              <ndc>829</ndc>
              <vmscno>3069998</vmscno>
            </vmscid>
          </neid>
        </gsm_net_param>
      </pos>
    </slia>
  </svc_result>
*

Now my task is to print the character present before </msid> and before </result> to another file so that output is something like this:

8093078040    ABSENT SUBSCRIBER
8738383838    ABSENT SUBSCRIBER

Any idea pls..!!

You can check out this as a start:

Hi,
In bash with grep (with option support -o and -P) and paste:

paste - - < <(grep -oP '[^>]*(?=</(msid|result))' file)

Regards.

For those that need something more portable or just hate awk:

sed -n -e 's;.*<msid[ ]*[^>]*>\([^<]*\).*;\1;p' \
       -e 's;.*<result[ ]*[^>]*>\([^<]*\).*;^I\1^B;p'  |
tr -d '\012' |
tr '\002' '\012'

The ^I and ^B are control characters (tab and Ctrl-B)

Thanks guys