switch level and timestamp

This commit is contained in:
Paul Campbell 2024-03-28 10:47:48 +00:00
parent a1ff73b895
commit 0224e9d5b7

View file

@ -9,14 +9,13 @@ struct Cli {
fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
let re = regex::Regex::new(r"^(.*)\s+(.*)$")?;
let re = regex::Regex::new(r"^(.*?)[\t\s]+(.*?)[\t\s]+(.*)$")?;
for line in read_to_string(cli.input)?.lines() {
if let Some(caps) = re.captures(line) {
println!("{:5} {}", &caps[1], &caps[2]);
println!("{} {:5} {}", &caps[2], &caps[1], &caps[3]);
} else {
println!("{}", line);
}
println!("{}", line);
}
Ok(())
}