Verified Commit b5d0fab0 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Experiment: Get the IP prefix to sort them out

parent f5807f1a
......@@ -5,3 +5,4 @@ authors = ["Michal 'vorner' Vaner <michal.vaner@nic.cz>"]
[dependencies]
csv = "0.14"
regex = "0.1"
extern crate csv;
extern crate regex;
use std::process::*;
use std::thread;
use std::sync::*;
use regex::Regex;
fn main() {
let mut running = Vec::new();
for arg in std::env::args() {
let a_cp = arg.clone();
let prefix = Regex::new(r"^(.[^.]?)").unwrap();
running.push(thread::spawn(move || {
let mut unzip = Command::new("pbzip2").arg("-dc").arg(a_cp).stdout(Stdio::piped()).spawn().expect("Failed to start unzip");
{
......@@ -14,7 +18,9 @@ fn main() {
let mut reader = csv::Reader::from_reader(&mut output);
for row in reader.records() {
println!("{:?}", row);
let row = row.unwrap();
let iprefix = prefix.captures(&row[0]).expect("Doesn't match").at(1).unwrap();
println!("{} {}", &row[0], iprefix);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment