Loading
Home ›
More Working with CSV Files from the Command Line
Trending Topics
| OpenLDAP Everywhere Reloaded, Part I | May 23, 2012 |
| Chemistry the Gromacs Way | May 21, 2012 |
| Make TV Awesome with Bluecop | May 16, 2012 |
| Hack and / - Password Cracking with GPUs, Part I: the Setup | May 15, 2012 |
| An Introduction to Application Development with Catalyst and Perl | May 14, 2012 |
| Cryptocurrency: Your Total Cost Is 01001010010 | May 09, 2012 |
- OpenLDAP Everywhere Reloaded, Part I
- Strip DRM from WMV File
- Validate an E-Mail Address with PHP, the Right Way
- Boot with GRUB
- Why Python?
- A Statistical Approach to the Spam Problem
- Chapter 16: Ubuntu and Your iPod
- Why Hulu Plus Sucks, and Why You Should Use It Anyway
- Building an Ultra-Low-Power File Server with the Trim-Slice
- Science the GNU Way, Part I
- Editorial Standards?
4 hours 8 min ago - Great one
5 hours 42 min ago - Common form in many
6 hours 3 min ago - Awsome
11 hours 6 min ago - Euro 2012 Coupon Codes - Get 20% Off Pavtube TiVo Converter
3 days 9 hours ago - Euro 2012 Big Sale: 20% Off Instant Savings on TiVo Converter
3 days 9 hours ago - MakeMKV works as well, though
3 days 10 hours ago - Euro 2012 Big Sale: 20% Off Instant Savings on TiVo Converter
3 days 10 hours ago - Awesome
4 days 8 hours ago - Who worries approx the
4 days 10 hours ago





Comments
Process Substitution
I've never seen this 'Process Substitution' done before! I just had a quick look at it in the Bash man page. It's something that would've been very used to me in a few occasions over the past few months. Perhaps I haven't heard of it because it's not part of the Posix standard?
Very cool! Thanks for showing us.
Regards,
Matt.
--
Regards,
Matthew Cengia
Useful even if not often used
Not something I use very often, it seems a bit "involved" so it doesn't always occur to me at first, but it is useful.
According to wikipedia ksh, zsh, and rc also support process substitution.
Mitch Frazier is an Associate Editor for Linux Journal.
text
these videos are great. i'd love to be able to follow up and learn for myself.
is there a chance you could post the session text so we could copy/paste/play?
thanks, AB
Good Idea
Here's a shell script that contains the code from this video and the previous one:
#!/bin/bash # Extract emails: # Could also do: grep -i -o '[^,]*@[^,]*' stuff.csv cut -f 3 -d , stuff.csv echo # Use emails to extract lines: for i in $(cut -f 3 -d , stuff.csv | sort --ignore-case | uniq --ignore-case) do grep -i -F "$i" stuff.csv | head -n 1 done echo # Make sure posix mode is OFF so process substitution works "<(...)" syntax. set +o posix # Use emails to de-dupe a file and then extract lines: for i in $(comm -23 \ <(cut -f 3 -d , stuff.csv | sort --ignore-case | uniq --ignore-case) \ <(cut -f 3 -d , nostuff.csv | sort --ignore-case | uniq --ignore-case)) do grep -i -F "$i" stuff.csv | head -n 1 doneHere's stuff.csv:
And nostuff.csv:
Mitch Frazier is an Associate Editor for Linux Journal.
the comm command is great.
the comm command is great. set difference on the command line has always been useful to me. thanks for the example!