- cd Desktop
- git clone https://github.com/sauuyer/unix-shell-working-with-data
- cd unix-shell-working-with-data
- ls
- cd data/mimic... click tab to autocomplete the mimic folder name
- ls
- cat LICENSE.txt
- nano LICENSE.txt
- cat labevents.csv wow! this is a long readout! use control+c to escape it if nessisary how might we learn about the contents of csvs more effectively?
- wc transfers.csv
- man wc
- wc -l transfers.csv
- head labevents.csv
- head -n1 labevents.csv
- tail -n3 labevents.csv
- head -n1 *.csv
- mkdir data_summaries
- head -n *.csv > data_summaries/csv_col_headers.txt
- grep "subject_id" *.csv
- grep -l "subject_id" *.csv save this list to a text file in your data summaries folder
- grep -l "subject_id" *.csv > data_summaries/subject_related_tables_list.txt
- subjects_list="$(grep -l 'subject_id' *.csv)"
- echo "$subjects_list"
- for thing in $subjects_list; do echo this file contains a subject id: $thing done
- for i in $subjects_list; do head -n2 $i; done
- history
- history > data_summaries/history.txt
- awk '/ENTEROCOCCUS/' microbiologyevents.csv | head
- join -1 2 -2 2 -t , patients.csv labevents.csv > data_summaries/merged_patients_labs.csv