#!/usr/bin/perl
# http://perlmonks.org/?node_id=1208527
use strict;
use warnings;
local $/ = '}'; # use } as line terminator...
while(<DATA>)
{
s/.*\K\{ Name.*\}//s;
print;
}
__DATA__
{ Name 1.2.3 xxxx xxxxx}
where xxxx and xxxxx could be a-z, 0-9 or : (a single colon).
There could be one or more spaces after { and before the } and there c
+ould be one or more spaces between the groups in the string. Also the
+ string could be split over two lines like
{ Name 1.2.3
xxxx xxxxx }
{ Name 1.2.
3 xxxx xxxxx}
{ Name 1.2.3 xxxx
xxxxx }.
So it could be split at a space or after a dot. There could be one or
+more spaces at the end of the split line before the newline like this
{ Name 1.2.3\ \ \ \
xxxx }
where I use \ to denote a space.
My question is how do I get rid of all these strings in a file. I'm us
+ing Perl under Windows 10 if that helps.
Thanks.
Outputs:
where xxxx and xxxxx could be a-z, 0-9 or : (a single colon).
There could be one or more spaces after { and before the } and there c
+ould be one or more spaces between the groups in the string. Also the
+ string could be split over two lines like
.
So it could be split at a space or after a dot. There could be one or
+more spaces at the end of the split line before the newline like this
where I use \ to denote a space.
My question is how do I get rid of all these strings in a file. I'm us
+ing Perl under Windows 10 if that helps.
Thanks.