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

How is that different from

    echo '999 888' | cut -f2 -d " "
except for the default delimiter being space for awk?


   echo '999  888' | cut -f2 -d " " # notice two consecutive spaces
returns NULL.


There are invalid column separators for awk too. To handle consecutive spaces in cut you have squeeze them:

  echo '999  888' | tr -s " " | cut -f2 -d " "


Right, that would be expected though? I suppose awk is better for parsing formatted (padded) output.




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

Search: