Ubuntu: Search csv file column


Is there a way to search the content of a specific column of a csv file using the terminal. But that it still returns all the information of the rest of the columns.

I want to be able to search for a string in a column of a csv file and if it matches return all of the information in the same Row

Is there away of implementing it into a shell bash file and ask the user what string to search


Lets say your string to search is "name" in the 4th column, then use

awk -F ',' '$4 ~ /^name$/' filename.csv  


awk -F',' '$N == "string to search"' filename.csv  

Replace N with column number and filename.csv with filename to search

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »