I have multiple lines I would like to extract from text formatted in columns. How do I get the entire column?

Column1 Column2 Column3
textA   textB   textC
textAA  textBB  textCC

I am familiar with sed and awk tools, but not sure how to use them if for this example I wanted to show all data in column2

  • Welcome, the data and the header? Commented Jul 27, 2021 at 20:50
  • so I run a command that ouput the ethernet interfaces of a device...column1 would be the eth port, column2 would be MAC addesses. I want to parse the MAC addresses from all the other data that is displayed in this command (5 total columns) but all I care about in this case is collecting the MAC add.
    – mcv110
    Commented Jul 27, 2021 at 21:06
  • 2
    It would be better if you edit the question presenting the actual use case and sample data, and what process you want to do with it. It would seem an X Y problem. Commented Jul 27, 2021 at 21:15
  • 1
    Please show actual data, and ideally also the command that generated it.
    – Kusalananda
    Commented Jul 27, 2021 at 21:34
  • 1
    Since you're familiar with awk, it's not clear why this problem would have you stumped as it's the most basic awk operation there is. Maybe there's more to it than you've stated and shown in your question? Please edit your question to clarify the problem.
    – Ed Morton
    Commented Jul 27, 2021 at 21:49

1 Answer 1


The simple answer is awk

awk '{print $2}' filename

For more info about awk, click the tag then click the "Learn more" link.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .