3
\$\begingroup\$

During breaks, I find myself playing Emerald version a lot and was tired of having to use the school's slow wifi to access the internet. I wrote a scraper to obtain cheat codes and send them to my psp device. I couldn't come up with a better way of removing the extra whitespace. Any areas I could improve on?

#!/bin/bash

wget -q -O - 'goo.gl/vfYA94' | \
  sed -En '/<strong>([1-9]|[12][0-9]|3[01])/,/<\/blockquote>/p' | \
  sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | \
  egrep -v '^[[:space:]]*$|^#'
\$\endgroup\$
2
\$\begingroup\$

I presume you are mostly after getting rid of egrep, so sed command to remove empty lines:

'/^[[:space:]]*$/d'
\$\endgroup\$
  • \$\begingroup\$ For whatever reason that was the only pattern that removed the empty space gap between the 24th cheat. My first approach was sed 's/ //g' but I just brute forced with egrep. Thanks for the tip, man! \$\endgroup\$ – user27606 Jul 2 '14 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy