How to get second last field from a cut command

前端 未结 6 2113
南方客
南方客 2020-12-04 19:04

I have a set of data as input and need the second last field based on deleimiter. The lines may have different numbers of delimiter. How can I get second last field ?

6条回答
  •  醉话见心
    2020-12-04 20:01

    Got a hint from Unix cut except last two tokens and able to figure out the answer :

    cat datafile | rev | cut -d '/' -f 2 | rev
    

提交回复
热议问题