while (<>) { next if (/^#/); s/(Key [0-5] 0x\w{14}).*/$1/; } continue { print }