Nov 8, 2002 #1 user2base Technical User Oct 16, 2002 29 GB I have a file that looks like this: blabla ! ! ! bla bla ! bla blablabla ! ! etc... How to remove all the ! in a series but one so that the result looks like: blabla ! bla bla ! bla blablabla !
I have a file that looks like this: blabla ! ! ! bla bla ! bla blablabla ! ! etc... How to remove all the ! in a series but one so that the result looks like: blabla ! bla bla ! bla blablabla !
Nov 8, 2002 #2 Zas Programmer Oct 4, 2002 211 US whats you data output when you make the file? Upvote 0 Downvote
Nov 8, 2002 #3 justice41 Programmer May 29, 2002 755 US You can set a 'seen' flag if a line contains a '!' and then skip any other lines after that which contain a '!'. A simple example: Code: my $seen = 0; while (<DATA>) { next if $seen and /^!$/; $seen = /^!$/ ? 1 : 0; print; } jaa Upvote 0 Downvote
You can set a 'seen' flag if a line contains a '!' and then skip any other lines after that which contain a '!'. A simple example: Code: my $seen = 0; while (<DATA>) { next if $seen and /^!$/; $seen = /^!$/ ? 1 : 0; print; } jaa