#!/usr/bin/perl use warnings; use strict; while (<DATA>) { my $remove_new_line = /string1/ .. /string2/; chomp if $remove_new_line and 0 > index $remove_new_line, 'E'; # not the last line print; } __DATA__ x y z string1 a b c string2 1 2 3
Output:
x y z string1abcstring2 1 2 3
In reply to Re: Remove newline between strings
by choroba
in thread Remove newline between strings
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |