Problem Statement

I am not able to get the values in second and fourth column.


grep -i "AUGC\|AACN\|AACY" output.csv | cut -d ',' 2,4


  • What's the exact output you're expecting? – tachomi Sep 10 '15 at 0:41
  • This looks like a partial JSON document. What does the full document look like? If it's JSON, you should be using a JSON parser (like jq) and not a line-oriented text manipulation tool. – Kusalananda Mar 25 at 19:30

To specify what columns to output, use the -f option of cut:

cut -d, -f2,4

Your file seems structured, are you sure the expected output for the given line would be the following?

  • can you also please tell me how to eliminate ,{ and repplace with - in output – Madhusudan Joshi Sep 10 '15 at 9:12
  • @Joshi: You can use sed: ... | sed -e 's/,{/-/' – choroba Sep 10 '15 at 9:14
  • sed: command garbled: s/,[/-/ – Madhusudan Joshi Sep 10 '15 at 9:25
  • @Joshi: You should use copy'n'paste. { and [ are different characters with different meaning. – choroba Sep 10 '15 at 9:32
  • 1
    @Joshi: To turn a special character to a literal, backslash it: s/,\[/-/ – choroba Sep 10 '15 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.