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

Silly bash function I use all the time.

  function f {
    awk '{print $'$1'}'
  }

  cat tab-separated | f 2 > just-the-2nd-column


cut -f2 tab-separated > just-the-2nd-column


I have a script much like cut, but which can reorder and duplicate fields.

http://github.com/ChickenProp/f/tree/master


doesn't work if it's any-amount-of-whitespace separated


-d'<tab>'


Nope: echo 'a b' | cut -d' ' -f2 a b


load "tab-separated" ( :f1:::'\t', :f2:::'\t', :f3::: ) as x;

create "just-the-2nd-column" from x ( :f2::: );

-- http://github.com/shuLhan/vos




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

Search: