#!/usr/bin/perl -w # txtRemoval.pl --in=%in% --out=%out% # This script removes specific text from a file for the Mars 830 Forecast use strict; use warnings; use Getopt::Long; my $opt = {}; GetOptions ($opt, 'in=s', 'out=s', ); my $infile = $opt->{'in'}; my $outfile = $opt->{'out'}; ## make sure we have the right options unless ( defined($opt->{'in'}) and defined($opt->{'out'}) ) { die "Usage: $0 --in=INFILE.TXT --out=OUTFILE.TXT\n"; } open my $in, "<", $infile or die $!; open my $out, ">", $outfile or die $!; while (<$in>){ s/^(?:L\d+|DETAIL|SPACE|SUMMARY),//; print $out $_; } close $in; ## close file handles close $out;