in reply to Regex to remove data
Something like this should do the trick:
#! perl use strict; use warnings; my @lines = <DATA>; s/ ^ [A-Z\s]+ $ //x for @lines; print for @lines; __DATA__ AAAAAAAA AAAA AAAAAAA AAAA AAA AAA Leave me intact PLEASE
Output:
0:10 >perl 369_SoPW.pl Leave me intact PLEASE 0:13 >
Update 1: Note that this will also remove blank (i.e. empty) lines.
Update 2: Changed
print "@lines";
to
print for @lines;
to address the issue of leading spaces raised by Anonymous Monk, below.
Hope that helps,
Athanasius <°(((>< contra mundum
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex to remove data
by rjt (Curate) on Nov 06, 2012 at 17:19 UTC | |
|
Re^2: Regex to remove data
by Anonymous Monk on Nov 06, 2012 at 14:23 UTC |