Split output of command by columns using Bash?

前端 未结 10 877
遥遥无期
遥遥无期 2020-12-23 02:46

I want to do this:

  1. run a command
  2. capture the output
  3. select a line
  4. select a column of that line

Just as an example, l

10条回答
  •  星月不相逢
    2020-12-23 03:31

    try

    ps |&
    while read -p first second third fourth etc ; do
       if [[ $first == '11383' ]]
       then
           echo got: $fourth
       fi       
    done
    

提交回复
热议问题