I have a script which parses through a test document ans removes unwanted lines. What I am having trouble doing is stripping away carriage returns for lines that meet a predetermined criteria. The following is a portion of the script.
while(<STDIN>) {
/^ Some text matching
.*)/ && do {
# Strip off the first part of the message text lines
$_ = $1;
last DATA_IN;
};
/^ THIS TEXT
.*)/ && do
{
# Strip off the first part of the message text lines
$_ = $1;
last DATA_IN;
};
}
I would like to have only the lines that start with 'THIS TEXT:' strip the 'THIS TEXT:' portion, which is working right now, AND also remove any carriage returns from the matched lines. I've been trying the chop and chomp functions but always seem to remove lines from output that I am not intending to. Any help would be appreciated
Thanks,
Doug
while(<STDIN>) {
/^ Some text matching
# Strip off the first part of the message text lines
$_ = $1;
last DATA_IN;
};
/^ THIS TEXT
{
# Strip off the first part of the message text lines
$_ = $1;
last DATA_IN;
};
}
I would like to have only the lines that start with 'THIS TEXT:' strip the 'THIS TEXT:' portion, which is working right now, AND also remove any carriage returns from the matched lines. I've been trying the chop and chomp functions but always seem to remove lines from output that I am not intending to. Any help would be appreciated
Thanks,
Doug