Skip to content

Instantly share code, notes, and snippets.

@tomatoiscoding
Last active October 8, 2017 09:52
Show Gist options
  • Select an option

  • Save tomatoiscoding/352bd308f55a325ad3e42936e2868ef8 to your computer and use it in GitHub Desktop.

Select an option

Save tomatoiscoding/352bd308f55a325ad3e42936e2868ef8 to your computer and use it in GitHub Desktop.
cut -d ',' -f1 FDADOS_CENSO2014.csv|tail-n +2|sort|uniq -c|sort -nr
# calculate the number of fields in a csv file
head -n 1 FDADOS_CENSO2014.csv | awk -F ',' '{print NF}'
# count null values using awk
for j in {1..123}
do
awk -F, -v i=$j '$i==" "{N++} END{print N}' FDADOS_CENSO2014.csv >> empty
done
awk -F, '$2!=" "' test1.txt > test2.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment