Submitted Questions

  • Print nth column of pattern

    How to print nth column of a pattern/file without using awk,cut commands?

    Sathish Krishnan Venkatachalam

    • Aug 7th, 2020

    I hope the below answer, to retrieve 3rd column without using awk (or) cut, use the following command:
    sed s/^(.*) (.*) (.*) (.*)$/3/g file.txt
    insert or delete "(.*)" based on which column to be retrieved and change "3" to nth column no.

    Ashok

    • May 27th, 2018

    Sed -n np file.txt