Last active
September 17, 2021 14:47
-
-
Save mikybars/765aa9e2bf2a6c3e058e4c13a0695f80 to your computer and use it in GitHub Desktop.
[Select rows and columns from tabular data] #csv #awk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# data.csv: | |
# | |
# Año,Marca,Modelo,Descripción,Precio | |
# 1997,Ford,E350,"ac, abs, moon",3000.00 | |
# 1999,Chevyr,Venture,Extended Edition,4900.00 | |
# 1999,Chevy,Venture,"Extended Edition, Very Large",5000.00 | |
# 1996,Jeep,Grand Cherokee,"MUST SELL! air, moon roof, loaded",4799.00 | |
awk -F, 'NR==2,NR==5 {print $2 " " $3}' <data.csv | |
# Ford E350 | |
# Chevyr Venture | |
# Chevy Venture | |
# Jeep Grand Cherokee | |
awk -F, 'NR==2 || NR==5 {print $2 " " $3}' <data.csv | |
# Ford E350 | |
# Jeep Grand Cherokee | |
awk -F, 'NR>1 {OFS=" | "; print $1,$2 " " $3}' <data.csv | |
# 1997 | Ford E350 | |
# 1999 | Chevyr Venture | |
# 1999 | Chevy Venture | |
# 1996 | Jeep Grand Cherokee |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment