简体   繁体   中英

How to extract specific columns in a csv file at a particular date using shell-scripting?

here is an extract from the csv file csvfile

I need to extract extract all columns with date 1/3/06 and having the 6th column 'MISSING PERSON'.

I have naively tried using GREP as such

 grep "1/3/06" SacramentocrimeJanuary2006.csv | grep "MISSING PERSON"

but dont get the deisred output

Could you please try following.

awk '/^1\/3\/06$/' && $6=="MISSING PERSON"'  Input_file

Change from awk to awk 'BEGIN{FS=OFS=","}.... in above code in case your Input_file is comma separated and you need output in comma separated fashion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM