`perl script.pl <infile >outfile`#!/usr/bin/perl -w use strict; my $do_i_chomp?; # off by default while(<>){ # read from STDIN $do_i_chomp? && chomp; # chomp if you should m/^DESCRIPTION$/ && do{ !$do_i_chomp?; # flip chomping on print; # print the DESCRIPTION line }; print; # print the line m/^ENDDESCRIPTION$/ && do{ print "\n$_"; # print newline, then the ENDDESCRIPTION +line !$do_i_chomp?; # flip chomping off }; }
~Particle
In reply to Re: Removing linefeeds from part of a file
by particle
in thread Removing linefeeds from part of a file
by Desdinova
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |