fork download
  1. #!/bin/bash
  2. s='abc,123,mno,xyz,1234
  3. mno,123,abc,rpt,pqr,2345
  4. xyz,456,uyt,rtp,rto,'
  5. awk -F, '{s=(NF==6 ? $3","$4 : $3); print s}' <<< "$s"
Success #stdin #stdout 0.01s 5520KB
stdin
Standard input is empty
stdout
mno
abc,rpt
uyt,rtp