csv-txt-excel-parallel-toolkit 0.4.7

A parallel and fast command line toolkit for small and large (>10G) CSV, TXT, and EXCEL files, with a unified api.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::utils::cli_result::CliResult;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;

pub fn run(path: &Path, sep: &str) -> CliResult {
    // open file and header
    let mut rdr = BufReader::new(File::open(path)?).lines();

    if let Some(r) = rdr.next() {
        r?.split(sep)
            .enumerate()
            .for_each(|(i, v)| println!(" {i:<5}{v}"));
    };

    Ok(())
}