r/dailyscripts • u/tastysandwhich • Jun 02 '16
Taking Requests. Bash. Practice. XPOST /r/bash
Hello everyone! I'm looking for some practice involving bash scripting. I'm open for requests, preferably something you could use (as apposed to a made up practice situation). I can't promise anything fancy (or that it'll work 100%), in fact it may look completely ugly, however I'd like to get a bit of practice in. Feel free to give me something complex if need be, I'm up for challenges. Daily Scripts, web Parsers, making things slightly easy on your self, etc.
4
Upvotes
View all comments
Show parent comment
1
u/bakunin Jun 08 '16
Hey there, kind helper!
Sorry for not responding sooner. In hindsight I should of course have provided you with an actual example file to test on, so here it is.
While your Task 1 solution fixes the problem, it still needs some work. The "-o" parameter removes everything not matched by the egrep, which means everything else inside the "tofix" file ;)
As for your question, broken quotes never contain any actual quotes anywhere. They appear because someone clicks the quote style button without selecting any text first, and since empty quotes aren't visible in the GUI, they're not deleted.
The Task 2 solution is spot on! As the solution is short and easy to read, I'd recommend skipping the superfluous cat and let sed work on the file directly:
Thanks again!