Sample Header Ad - 728x90

How to use grep on column?

8 votes
4 answers
82319 views
I want to apply grep on particular column in column command. myfile.txt 3,ST,ST01,3,3,856 3,ST,ST02,4,9,0234 6,N1,N101,2,3,ST 6,N1,N102,1,60,Comcast 6,N1,N103,1,2,92 My Command: column -s, -t < myfile.txt | grep -w "ST" Here I want to only grep the pattern ST in 2nd column. How to do this ? **Expected Result:** 3 ST ST01 3 3 856 3 ST ST02 4 9 0234
Asked by rajagopalx (183 rep)
Jan 10, 2017, 04:42 PM
Last activity: May 18, 2025, 01:05 AM