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

  ls -l | tr -s ' ' | cut -d ' ' -f 5


Exactly! Exactly! And now fix it to work with tabs :-)


And leading whitespace. Compare:

  $ printf " one two  three"  | tr -s ' ' | cut -d ' ' -f 1

  $ printf " one two  three"  | awk '{print $1}'
  one


  ps ax | sed 's/^\s\+//; s/\s\+/ /g;' | cut -d ' ' -f 4


  echo -e '1\t2\t3\t4\t5' | expand -t 1 | cut -d ' ' -f 3




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: