use std::env; use std::io; use std::process; fn main() { let args: Vec = env::args().collect(); //println!("{:?}", args); let to_grep = &args[1]; if args.len()<2{ process::exit(0x0100); } if &args[1]=="-h" { println!("GREP in Rust -h - this help"); process::exit(0x0100); } loop{ let mut piped = String::new(); io::stdin().read_line(&mut piped) .expect(""); if piped == "" { break; } if piped.contains(to_grep){ print!("{}",piped); }; } }