use AWK to write a Script analyzing a CSV file use makefile to run the script
In this project I create a zsh shell script to understand data that is dowloaded. In order to execute the script easily I created a makefile which actually downloads the data and executes the script, using a makefile makes the execution of the shell easier through one command in the terminal.
This repository allows us to use a makefile to dowload a .csv
file containing information about NYC inmates discharged from prison in 2018 and run a shell script which uses AWK commands to analyze the information about the inmates.
The shell script
- calculates the amount of discharged prisoners according to gender
- calculates the amount of discharged prisoners according to age
- calculates the average age of the discharged prisoners
- prints all this information to a new file
This raw data is downloaded from NYCOpenData. The dataset includes the inmate ID, data admitted, date released, race, gender , age , inmate status, and convicted charge. For this project I will utilize the gender and age (columns 5 and 6) of the inmate information.
please be sure that curl is installed on your computer before doing this exercize
- Open the terminal
- Be sure that you are in the file you would like to clone the repository into, if you are not-
cd
into the appropriate file - Clone this repo by typing in terminal:
git clone https://github.com/RachMink/CISC3140Lab3Task1.git
- after cloning direct yourself into the proper folder using
cd CISC3140Lab3Task1
- use the
ls
command to see that your folder containsREADME.md
makefile
andnycScript.sh
- run command
make
- now if you
ls
you should have two extra files calledinmateFile.csv
which contains the original data used andnewFile.csv
which contains the filtered data - if you would like to only use the terminal in this exercize you can type
cat newFile.csv
which should print the amount of inmates discharged per gender and age, otherwise you should be able to open a.csv
file through your finder on your pc
- please look at comments in script to understand how the script works
- any blank spots in the output file are because these feilds were not specified in the input file