Skip to content

Instantly share code, notes, and snippets.

@keck
Created March 20, 2018 19:25
Show Gist options
  • Save keck/82f5c4658b33da4ba4afa3da28d33260 to your computer and use it in GitHub Desktop.
Save keck/82f5c4658b33da4ba4afa3da28d33260 to your computer and use it in GitHub Desktop.
aless(){ perl -e 'BEGIN{$D='\t';$f=shift;%cs=();} open(IN,"<",$f); while(<IN>){$c=0; map{ $s=length;$cs{$c}=($s>$cs{$c})?$s:$cs{$c};$c++;}split /$D/;}END{$cs{0}++;$x=join ",",map{($_>0)?($cs{$_}=$cs{$_}+$cs{$_-1}+1):$cs{$_}; $cs{$_}} sort{$a<=>$b}keys %cs;system("less -S -x$x $f");}' $1; }
export -f aless
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment