The sed
Language
A vim
warmup: Clean this @#$% mess up:
covid19ByState. The columns
are: totalCases per100K sevenDayAvg sevenDayAvgPer100K.
The NYTimes is the data's source.
Here is another data source for infections by state at colleges: NYTimes by state data for colleges.
Extract and clean this data into a usable format. Put it in columnar format with state, cases, numSchools.
Useful Vim Hint In command mode, if you type J, you wil join the cursor's line with the next line. This can be preceded by a number with a predictable result.
Here is your mission. You can find the
sed
manual here.
A lot of by-state data comes in with the state name at
the beginning of each record (row). Many states have two words
in their names and this can cause headaches when we try to
awk
these files.
Your mission is as follows
Write a sed
program called stateFixer.sed
which changes state names to their two-letter postal
abbreviations. Make sure you include all of them.
This link
from the USPS shows them. Watch out for case!
The file perCapitaIncomeByState
contains income on per capita earnings. Use this as a test
case for your sed
program.