Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

> [...] you need to flatten the whitespace first with sed

by "flatten the whitespace" do you mean turning many spaces into one space? If so, I have always used tr with the -s (squeeze) option for that:

    $ echo "one       two     three" | tr -s " " | cut -d " " -f 3
    three


Didn't know about that option, I always did it with sed. Thanks! :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: