perl -ne "print unless /^#/" infile > outfile #### use strict; use warnings; die("usage: $0 {infile} {outfile}\n"; if @ARGV != 2; my ($file_in, $file_out) = @ARGV; open(my $fh_in, '<', $file_in) or die("Unable to open input file \"$file_in\": $!\n"); open(my $fh_out, '>', $file_out) or die("Unable to create output file \"$file_out\": $!\n"); while (<$fh_in>) { if (!/^#/) { print $fh_out $_; } } #### use strict; use warnings; die("usage: $0 {filein} {fileout}\n"; if @ARGV != 2; my ($file_in, $file_out) = @ARGV; open(my $fh_in, '<', $file_in) or die("Unable to open input file \"$file_in\": $!\n"); open(my $fh_out, '>', $file_out) or die("Unable to create output file \"$file_out\": $!\n"); print $fh_out (grep !/^#/, <$fh_in>);