4 ms·
Yeah, i have no problem with python or any other language. Use what works for you. But perl does an acceptable job on every one of your examples.. perl -na
by tux1968 13y ago
Yeah, i have no problem with python or any other language. Use what works for you. But perl does an acceptable job on every one of your examples..
perl -naE 'say $F[0], $F[1]'
perl -nae '$tot+=$F[1]; $c++;END{print $tot/$c}'
perl -ape 's/^.client="(.)",dev.*/\1/' foo.txt
And finally:
use JSON;
use IO::All;
use feature 'say';
$f = io('bus-stops.json')->all;
$j = decode_json($f);
$,=',';
for (@$j) {
say @$_{'no','lat','lng','name'};
}
I still think newbies would get much more value out of learning perl basics than spending any time on sed/awk intricacies. But to each his own.