tags:

views:

68

answers:

4

I'm looking through an Oracle script I found online, but it runs a sed command to filter results from a trace file. I'm running Oracle on a Windows server, so the sed command isn't recognized.

host sed -n '/scattered/s/.*p3=//p' &Trace_Name | sort -n | tail -1

I've tried reading the online documentation, but am still not sure how to interpret what this command is trying to filter. Would anyone be so kind as to help me interpret what this command is trying to filter? Or better yet, what I can run from a Windows command prompt to achieve the same result.

Thanks!

+4  A: 

It says "on lines that contain 'scattered' replace zero or more of any character followed by 'p3=' with nothing (delete it, in other words) and print the result" (-n says don't print lines unless there's an explicit print command).

For this example input:

abc organized p3=123
def scattered p3=456
ghi ordered p3=789

The output would be:

456
Dennis Williamson
For a DB FILE SCATTERED READ, p3 represents "The number of blocks that the session is trying to read from the file"
Gary
@Dennnis: Great explanation. Thanks a lot!
Kevin Babcock
@Gary: After a while and much searching, I finally figured that part out. Thanks for the response!
Kevin Babcock
+2  A: 
Many thanks for the explanation!
Kevin Babcock
+1  A: 

The sed command works with cygwin, a unix-like shell for Windows.

Thanks for the tip!
Kevin Babcock
+1  A: 

To address the other part of your question, the unxutils project ports many GNU utilities to Win32, including sed. Find out more.

APC
Thanks for the link!
Kevin Babcock
better to use GNU ones at http://gnuwin32.sourceforge.net/packages.html
ghostdog74