first read line and split by tab get the value of 2nd index .if it's user enter value then print all the values .for example
void cvsRead() throws FileNotFoundException, IOException {
String line, userinput = "";
BufferedReader br = new BufferedReader(new FileReader("yourfile.cvs"));
Scanner scan = new Scanner(System.in);
System.out.println("enter the column ");
userinput = scan.nextLine();
int i = 0;
String[] spmap = br.readLine().split("\t");
while ((line = br.readLine()) != null) {
String[] sp = line.split("\t");
if (sp[2].equals(userinput)) {
i++;
System.out.println(i + ")");
for (int x = 0; x < spmap.length; x++) {
System.out.println(spmap[x] + " | " + sp[x]);
}
}
}
}
output>>
enter the column
c1
1)
A | 20
B | cd
C | c1
D | d1
E | cd1
2)
A | 40
B | gh
C | c1
D | h1
E | gh1