Skip to content

Instantly share code, notes, and snippets.

@nishidy
Last active June 19, 2016 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nishidy/17ad2523687635e11281 to your computer and use it in GitHub Desktop.
Save nishidy/17ad2523687635e11281 to your computer and use it in GitHub Desktop.
Embulk plugin test.
def build_options(fields,x)
options = ""
fields.each do |field|
if x==0
options += "-e '#{field}' "
else
options += "-e \"#{field}\" "
end
end
return options
end
def each_packet(path, fields, x)
options = build_options(fields.split(/,/),x.to_i)
puts options
io = IO.popen("tshark -E separator=, #{options} -T fields -r #{path}")
while line = io.gets
puts line
break
end
io.close
end
each_packet(ARGV[0],ARGV[1],ARGV[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment