Skip to content

Instantly share code, notes, and snippets.

@apsamuel
Last active December 14, 2015 07:48
Show Gist options
  • Select an option

  • Save apsamuel/5052657 to your computer and use it in GitHub Desktop.

Select an option

Save apsamuel/5052657 to your computer and use it in GitHub Desktop.
filename = ARGV[0]
def parse_file(filename)
f = File.read(filename).split("\n").delete_if { |x|
! x.match(/.+Disk - \/.+Service.+/)
}
f.each { |x|
hostname, servicecheck = x.split(/\t/)[1,2]
puts "#{hostname} #{servicecheck}"
}
end
def check_arg
if ARGV[0] == nil or ARGV[0] == ""
puts "Usage: SCRIPT <filename>."
exit -1
end
end
check_arg()
parse_file(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment