A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label parse. Show all posts
Showing posts with label parse. Show all posts

How to really loop over filenames with spaces in

 Don't parse the output of "ls".

Instead:

for file in *

do

  ...

done


(source)

Parse a Perl stack trace for ease of understanding

Problem:

A Perl stack track is difficult to parse with my inferior human brain; I want to align each line horizontally so that discrepancies jump out at me.

Solution:

This isn't the whole solution, but it goes some way towards it.

perl script.pl | grep -v ^eval | perl -plne'$len=300-length($_); $space=" "x$len; s/called at /${space}called at /'