Unix [SOLVED]: trying to get the results using awk

Unix [SOLVED]: trying to get the results using awk

Home Forums Unix Unix [SOLVED]: trying to get the results using awk

Tagged: , , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #32559

    Anonymous

    QuestionQuestion

    I’ve a file named xyz.csv which are comma separated.I’m trying to get the output where the 2nd column should have value “01”, 50th column as “ABC” and the content of 80th column using nawk?

    #32560

    Anonymous

    Accepted AnswerAnswer

    Could you please try following and let me know if this helps.

    nawk -F"," '$2=="01" && $50 == "ABC"{print $80}'  xyz.csv
    

    OR

    If you are looking for 50th and 80th field’s value should be ABC and you want to print current line then following may help you in same.

    nawk -F"," '$2=="01" && $50 == "ABC" && $80 == "ABC"'  xyz.csv
    

    Source: https://stackoverflow.com/questions/47113325/trying-to-get-the-results-using-awk
    Author: RavinderSingh13
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.