[Tutor] Reading .csv data vs. reading an array

David Rock david at graniteweb.com
Tue Jul 16 09:11:57 EDT 2019


> On Jul 16, 2019, at 04:31, Alan Gauld via Tutor <tutor at python.org> wrote:
> 
> On 16/07/2019 09:59, Oscar Benjamin wrote:
> 
>>> All true, but sed - once you get used to it! - is easier IMHO
>>> and usually faster than Python - it's written in C...
>> 
>> I always think I'll like sed but whenever I actually try to use it I
>> just can't get the syntax together. 
> 
> 
> Id been using awk and sed for 15 years before I discovered
> Python (and perl) so they are kind of second nature.
> 
> If you can't settle with sed try awk, it's much simpler to
> use and almost as powerful but not as fast. I think awk is
> one of the most neglected of the *nix tools now that
> scripting languages like perl/python/ruby exist. But for
> line by line file processing it is superb.

The first O’Reilly book I ever purchased was “Sed & Awk”, and has been one of the most invaluable over the last 20 years.  While they are not the simplest tools to master, they are worth the effort; especially when you are trying to do inline “one-liners” to massage data or process large files.  That doesn’t mean it’s a requirement to know them, but it does get easier with practice.  That said, if making a little python one-off filter to do what you need is faster (to write) and works (well enough), it comes down to what your time is worth.

— 
David Rock
david at graniteweb.com






More information about the Tutor mailing list