#!/usr/bin/perl # use strict; use warnings; # my $match='XLON_DBX1AE_USD'; my $file = $ARGV[0]; # open (my $fh, '+<', $file) or die "Could not open \"$file\"$!\n"; # my $depth = 0; while(<$fh>) { if($_=~ /$match/){ $depth = /\}/ ? 0 : 1; while($depth) { $_=<$fh>; $depth-- if /}/; $depth++ if /{/; } } else { print; } }