perl -wMstrict -nE 'say "$. ".unpack("H*",$1) if /([\n\x{0B}\f\r\x{85}]{1,2})/' file #### 1 0a 2 0a 3 0a 4 0a 5 0a 6 0a