Getting certain columns in bash

前端 未结 3 740
时光取名叫无心
时光取名叫无心 2021-01-26 17:28

Suppose I have an array where each element in the array is in the following format:

someText (x1,y1,z1) (x2,y2,z2) (x3,y2,z3) KEY

What is the a

3条回答
  •  天涯浪人
    2021-01-26 18:25

    This is how you can get first and last element of your string in the array:

    echo "someText (x1,y1,z1) (x2,y2,z2) (x3,y2,z3) KEY" | rev | cut -d " " -f 1 | rev
    
    echo "someText (x1,y1,z1) (x2,y2,z2) (x3,y2,z3) KEY" | cut -d " " -f 1
    

提交回复
热议问题