The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 08-31-2007
ghostdog74 ghostdog74 is offline
Registered User
 

Join Date: Sep 2006
Posts: 1,582
only for one file. i leave it to you to do multiple files.
Code:
awk '/moid/{ gsub("<moid>|</moid>","");moid[c++]=$0}
    /<r>/{ gsub("<r>|</r>","");r[d++]=$0}
END{
  for(i=0;i<=c;i++) {
	print moid[i] " " r[i]
  }
}' "file"
output:
Code:
./test.sh
CcnCounters=CAPv3-Received-Total-Requests, Source = Proc_m0_s23 1100
CcnCounters=CAPv3-Received-Total-Requests, Source = _SYSTEM 2196
CcnCounters=CAPv3-Sent-Total-Requests, Source = Proc_m0_s23 1239
CcnCounters=CAPv3-Sent-Total-Requests, Source = _SYSTEM 2463
CcnCounters=CAPv3-Sent-Total-Requests, Source = Proc_m0_s21 1224
Reply With Quote