UNIX sed or awk - search and print key words in a line?

Discussion in 'Linux Discussion' started by John R, May 6, 2008.

  1. John R Guest

    John R
    I would like to use sed or awk to search and print specific key words from a file. Here's an example of a single line of a million-line text file:

    <WFMessage><EVENT>HostTransferCompleted</EVENT><CARRIERID>0001-0017</CARRIERID><
    CARRIERJOBID>0001-00172008031807591275</CARRIERJOBID><CEID>29218</CEID><CURRENTL
    OC>LSTB00124</CURRENTLOC><EQUIPMENTID_DEST>ZFG0330</EQUIPMENTID_DEST><EQUIPMENTI
    D_SRC>ZFG0910</EQUIPMENTID_SRC><MACROCOMPSTATUS>0</MACROCOMPSTATUS><RESOURCEID_D
    EST>LSTB00124</RESOURCEID_DEST><RESOURCEID_SRC>UTB00235</RESOURCEID_SRC><ZONEID_
    DEST></ZONEID_DEST></WFMessage>

    Remember, this is 1 line of multiple.

    I need an awk or sed statement which will produce the following from this single line:

    0001-0017 0001-00172008031807591275 ZFG0330 ZFG0910

    How can I do this?
Loading...

Share This Page