i have a csv file "emp.csv" with following information.
empid status
1 t
2 a
3 t
4 t
5 a
I need empid and status of employees having status="t" and the output should be in "res.csv" file
For this, you'll first want to import the existing data with Import-Csv - but since your file is technically a TSV (tab-separated instead of comma-separated), make sure you specify this with -Delimiter "`t":
$employeeStatusData = Import-Csv .\path\to\emp.csv -Delimiter "`t"
Import-Csv will parse the input file and store the resulting objects in $employeeStatusData. To filter these object based on the value of the status property/column, use Where-Object:
$filteredEmployeeData = $employeeStatusData |Where-Object status -eq 't'
Now that you have the relevant rows selected, you can export the data again with Export-Csv:
$filteredEmployeeData |Export-Csv .\path\to\res.csv -Delimiter "`t" -NoTypeInformation