6 ms·
I always get excited by these types of tools and then end up going back to awk. How do you beat something that's already pre-installed on every Unix system for
by zmmmmm 7y ago
I always get excited by these types of tools and then end up going back to awk. How do you beat something that's already pre-installed on every Unix system for the last 40 years?
Having said that ... these do look like they have some useful extras, in particular, around the annoying part of retaining / manipulating header rows ...
- Scarbutt 7y agoFor TSV, coreutils, awk, etc are nice to work with for sure but for CSV not so much.
- ISL 7y agoAt the risk of being flippant: sed 's/,/\t/g'
- bbernoulli 7y agoAnd hope you don't have any commas into your data?
- ISL 7y agoIn my line of work, that's an excellent assumption.
- misterdoubt 7y agoMust be nice to start work with clean data. Allow me to assure you that there are many, many others who don't have the luxury.
- Something1234 7y agoawk -F, ? Until you start dealing with quotes.
- boring_twenties 7y agoperl -MText::CSV will take care of that.
- UweSchmidt 7y agoI agree. Mastering any tool of that sort is a lot of effort and I'd rather invest it in a tool that's reliable and always available. If you have to explore data anyway, using basic unix tools, piping one into the other, always works. You end up with verbose, but readable code. Put it into a script, make sure it works in a more general case and you might get close to what some of the more specialized tools can do.
- pvg 7y agoHow do you beat something that's already pre-installed on every Unix system for the last 40 years? One simple and useful way is by being much faster, which is the case for these tools. There are benchmarks linked in the README.
- thewhitetulip 7y agoI totally agree. awk, sed, grep are amazing and it astonishes me how many people aren't fluently able to write scripts in it. I used to be in that camp few months earlier and I used to write everything in Python, but one day, I determined to learn shell scripting and I loved it. awk::Python what Java::Python. What we can do in 10 lines of Python can be done in one line of awk and it doesn't have to be unreadable! Main pain in the neck is finding a good tutorial. As usual, I started documenting what I learnt in an end to end guide here, https://github.com/thewhitetulip/awk-anti-textbook https://github.com/thewhitetulip/awk-anti-textbook
- perl4ever 7y agoIs there anything you can do with awk or sed that isn't built in to perl? I know I never used awk after I learned the latter, and sed very, very rarely.
- thewhitetulip 7y agoI tried to learn perl but I gave up halfway.
- j88439h84 7y agoI totally agree about the unnecessary verbosity. For a more concise Python on the command line, I like Mario: https://github.com/python-mario/mario https://github.com/python-mario/mario
- cf 7y agoThe original awk book from the creators is in my opinion really good. https://archive.org/download/pdfy-MgN0H1joIoDVoIC7/The_AWK_Programming_Language.pdf https://archive.org/download/pdfy-MgN0H1joIoDVoIC7/The_AWK_P...
- thewhitetulip 7y agoI found it to be a good introduction, but the issue is, it does not go in dept and teach by example.