factored out generic commented line dumping