need to get single column form csv file

hi 2 all

i need to get single column from one csv file

anyone help me !

>cat file.csv 
name,age
x,1
y,2
z,3

in this "file.csv" file i need only name column

can u help me !:b::b:

Check out the man page of the cut command and try it out. If you get stuck do not hesitate to ask here again.

is there any direct cmd to get single column ???/

Using a loop...

while IFS=, read NAME  rest_of_line; do
  echo $NAME
done < file.csv

Fine, if you don't have many columns.

Otherwise cut is probably the best option.

[house@leonov] cat data
x,1
y,2
z,3
[house@leonov] awk -F ',' '{print $1}' data
x
y
z

What is the problem trying out cut?

thank you dr.house

badan@debian:/$ cat /tmp/data
x,1
y,2
z,3

badan@debian:/$ cat /tmp/data | cut -d, -f1
x
y
z