Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! ruby
- #
- # Gets the unique OPC methods from the OPC analyzer trace log of all the methods TopView Configurator and Engine uses
- # Assumes that it has been given a valid file name
- if ARGV.length == 1 and File.exists?(ARGV[0])
- input = File.open(ARGV.first, "r").read
- # Build up a unique array of OPC methods
- opc_methods = []
- # For each line in the file, pull out the package::method name string and put it in the opc_methods collection
- input.lines.each do |line|
- if match = line.match(/\w+\:\:\w+/).to_s and !opc_methods.include?(match)
- opc_methods << match
- end
- end
- # Chop out all the repeats and print the unique method names
- puts "Unique OPC method calls:"
- opc_methods.each do |method_name|
- puts "#{method_name}\n"
- end
- else
- puts "Please give me the name of a valid file!"
- end
Add Comment
Please, Sign In to add comment