thendal
Programmer
- Aug 23, 2000
- 284
Hi all!
I have a file which separates each record with a empty newline at the end. I'm reading this file and pattern matching with characters i need to capture. But my problem is I'm not able to capture the empty newline at the end of the each record.
here is the file
record1
sasdsdasd
sadasdasd
asdasdadasd
record2
ers: ererklejr
erer:djfhsdf
dkjfkdf: djfksdfj
jskjfsdf: sdkfjksdfj
Record3
dfdfj: sdfjdkf
dfskfj: dfkjskf
currently my output looks something like this
record1|record2
i wanted the output to be
record1
record2
I'm not sure how to match the empty newline as every line has a newline ..i'm not sure how to differentiate a empty new line and a line with newline at the end.
here is what my newline match code looks
if($output=~/\n/)
{
print "At the end of the record \n";
}
but this matches with every single line of the file as it has a newline at the end.
Any advise will be greatly appreciated.
Thanks.
I have a file which separates each record with a empty newline at the end. I'm reading this file and pattern matching with characters i need to capture. But my problem is I'm not able to capture the empty newline at the end of the each record.
here is the file
record1
sasdsdasd
sadasdasd
asdasdadasd
record2
ers: ererklejr
erer:djfhsdf
dkjfkdf: djfksdfj
jskjfsdf: sdkfjksdfj
Record3
dfdfj: sdfjdkf
dfskfj: dfkjskf
currently my output looks something like this
record1|record2
i wanted the output to be
record1
record2
I'm not sure how to match the empty newline as every line has a newline ..i'm not sure how to differentiate a empty new line and a line with newline at the end.
here is what my newline match code looks
if($output=~/\n/)
{
print "At the end of the record \n";
}
but this matches with every single line of the file as it has a newline at the end.
Any advise will be greatly appreciated.
Thanks.