search-word-print-specific-string

Hi,
Our input xml looks like:

<doc>
  <str name="account_id">1111</str>
  <str name="prd_id">DHEP155EK</str>
  </doc>
- <doc>
  <str name="account_id">6666</str>
  <str name="prd_id">394531662</str>
  </doc>
- <doc>
  <str name="account_id">6666</str>
  <str name="prd_id">394805955</str>
  </doc>

here we want to get the account_id|prd_id to another text file, output.txt like:

1111|DHEP155EK
6666|394531662
6666|394805955

Can anyone help us with the unix command for this?

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.

Continue here: