#!/usr/bin/perl -w use strict; # Build a regex of "\d\d\d:|\s\d\d:|\s\s\d:|\s\s\s" my $str = join ":|", map { '\s'x$_ . '\d'x(3-$_) } 0 .. 3; while (<>){ s/^$str//; # Remove anything that matches regex from start of line print; }