3 ms·
awk is cool, and I use it from time-to-time but it is quite basic. I tend to prefer using Ruby (or Perl) instead. For example I recently needed to check for lo
by kevincox 6y ago
awk is cool, and I use it from time-to-time but it is quite basic. I tend to prefer using Ruby (or Perl) instead.
For example I recently needed to check for log output where two columns differed. For a simple case like this awk would have probably done the job too but Ruby and Perl just have so many functions built in.
... | ruby -ne '$_.chomp =~ /^added (.*) ipfs\/([^\/]*)$/ and $1 != $2 and print'
Perl supports similar `-n` and `-e` flags. It even makes it a bit easy to do the regex filter and match (The argument is implicit IIUC) but I tend to prefer Ruby because Perl has too many sigils for a casual user to remember.