The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 07-22-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,285
1st: Please use [ c o d e ] [ / c o d e ] tags!!

A bit lengthy, maybe someone comes up a shorter version:
Code:
cat infile |\
tr -d '\n' |\
sed 's/[^^]RFH/\nRFH/g' |\
sed 's!.*<RequestID>\([^<]*\)<\/RequestID>.*<error:Info>\([^<]*\)<\/error:Info>.*!\1 \2!g'
Both steps are combined. Not sure if you need to loop for the second step, if so, there is no need to loop, as sed take a stream and checks every single line of input. If you only want step 1 though, just stop after the 1st line of sed ie. redirect it to a new file or whatever.

Last edited by zaxxon; 07-22-2008 at 10:38 AM.. Reason: Adding notice to use code tags