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?
  2. Similar Threads: UNIX search
    Forum Title Date
    Linux Discussion How do I check if my linux, or unix, box is 32bit of 64bit through the terminal? Jul 3, 2008
    Linux Discussion How do I run multiple commands on a Unix/Linux system without a GUI? Jul 3, 2008
    Linux Discussion unix help!!!!!? Jun 18, 2008
    Linux Discussion Unix/programming question? Jun 18, 2008
    Linux Discussion free UNIX servers? Jun 3, 2008
    Linux Discussion Installing Unix with Windows XP? Jun 1, 2008
    Linux Discussion Drivers for Unix? May 30, 2008
    Linux Discussion What is recursive in Linux/Unix? May 30, 2008
    Linux Discussion Can we perform mathematical operations on UNIX dates? May 30, 2008
    Linux Discussion i need codings for unix commands in c language ...please help... an urgent task...? May 29, 2008

Share This Page