Use space as a delimiter with cut command

前端 未结 8 1173
[愿得一人]
[愿得一人] 2020-12-07 07:24

I want to use space as a delimiter with the cut command.

What syntax can I use for this?

8条回答
  •  孤城傲影
    2020-12-07 08:24

    Usually if you use space as delimiter, you want to treat multiple spaces as one, because you parse the output of a command aligning some columns with spaces. (and the google search for that lead me here)

    In this case a single cut command is not sufficient, and you need to use:

    tr -s ' ' | cut -d ' ' -f 2
    

    Or

    awk '{print $2}'
    

提交回复
热议问题