Hacker News new | ask | show | jobs
by souprock 2023 days ago
If a 1-liner run manually counts, feast your eyes on nearly a kilobyte of awful bash:

    for i in raw-* ; do cat $i | expand | egrep '[A-Z]{3} +[0-9]{4}|/2021' | sed -r -e 's!08/(..)/2021!aug\1!g'  -e 's!09/(..)/2021!sep\1!g' -e 's!10/(..)/2021!oct\1!g' -e 's!12/(..)/2021!dec\1!g' -e 's!01/(..)/2021!jan\1!g' -e 's!05/(..)/2021!may\1!g' -e 's!03/(..)/2021!mar\1!g' -e 's!02/(..)/2021!feb\1!g' -e 's!06/(..)/2021!jun\1!g' -e 's!04/(..)/2021!apr\1!g' -e 's!07/(..)/2021!jul\1!g' -e 's/([a-z]{3}[0-9]{2}) - ([a-z]{3}[0-9]{2})/\1\2/' -e 's!([a-z]{3}[0-9]{2}[a-z]{3}[0-9]{2}) +([0-9]{2}:[0-9]{2} [AP]M)!\1 N/A     \2!' -e 's!Live Online!Lve!' -e 's!Online Course!Onl!'  -e 's!Hybrid Course!Hyb!' -e 's!Face-to-Face!f2f!' -e 's!Directed Study!dir!' -e 's/(..):(..) ([AP])M - (..):(..) ([AP])M/\1\2\3\4\5\6/' -e 's/Palm Bay/PalmBay /' | while read where crn c1 c2 c3 type name ; read dates days time ; do printf "%s %-4s %s %s %-4s %-5s %s %s %s\n" $dates $days $time $type $c1 $c2 $c3 $crn "$name" ; done | sort | uniq | sort -k 5 > not-$i ; done
It chews on the results of a class schedule search: https://www.easternflorida.edu/academics/class-schedule-sear...

The problem being solved is that I have had as many as 4 kids taking classes at once, and that becomes impractical without coordinated schedules. Getting the data into plain text, with exactly one line per class, makes it easy to use grep for picking out possibilities.

1 comments

how does while with two reads work?
It deals with two lines of input. Probably the ";" should have been "&&" instead, so that either failure will end the loop.