Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
using_awk_on_csv_files [2016/02/29 14:08]
Joel Dare
using_awk_on_csv_files [2023/05/22 12:50] (current)
Joel Dare
Line 10: Line 10:
  
   awk -F "​\"​*,​\"​*"​ '​{print $3}' file.csv   awk -F "​\"​*,​\"​*"​ '​{print $3}' file.csv
 +
 +<box 50% round orange|Sweet Awk Magic>​[[https://​course.joeldare.com/​awk/​|Join my 90-minute workshop and learn my tips and tricks to quickly process CSV files with Awk.]]</​box>​
  
 As another example, take the following pipe delimited format: As another example, take the following pipe delimited format:
Line 30: Line 32:
  
   awk -F "​\"​*,​\"​*"​ '​{print $3 "​|"​ $1}' file.csv   awk -F "​\"​*,​\"​*"​ '​{print $3 "​|"​ $1}' file.csv
 +
 +====== Unmatched Error ======
 +
 +If you get an error about an unmatched comma, you are probably trying to run this in a csh shell instead of a bash shell. These shells behave a little differently. Here's the error you'll get.
 +
 +  '​Unmatched "​.'​
 +
 +One solution is to run this command from bash. To switch to a bash shell, just run the /bash/ command to switch to a bash shell.
 +
 +  bash
 +
 +Special thanks to Marina for reporting this error.
  
 ====== In an Awk File ====== ====== In an Awk File ======
comments powered by Disqus
using_awk_on_csv_files.1456754926.txt.gz · Last modified: 2020/06/01 22:53 (external edit)