A
Andrea Spitaleri
Hi everyone,
I need to confirm a my doubt.
I use to make filter which they work perfectly. I am wondering if the
style of these scripts are perl-fashion or not. Ex in.txt:
home
dog
cat
home
car
bus
etc
etc
to grab the text from "home" to other "home" I use to do:
while(<>){
if(/^home/){
print;
while(<>){
print;
if(/^home/){
exit;
}}}}
to get:
home
dog
cat
home
but is not really perl style, i should say. any suggestion?
btw, in such way I print also the last line starting with home. If I
don't want print it?? so like:
home
dog
cat
many thanks
regards
andrea
I need to confirm a my doubt.
I use to make filter which they work perfectly. I am wondering if the
style of these scripts are perl-fashion or not. Ex in.txt:
home
dog
cat
home
car
bus
etc
etc
to grab the text from "home" to other "home" I use to do:
while(<>){
if(/^home/){
print;
while(<>){
print;
if(/^home/){
exit;
}}}}
to get:
home
dog
cat
home
but is not really perl style, i should say. any suggestion?
btw, in such way I print also the last line starting with home. If I
don't want print it?? so like:
home
dog
cat
many thanks
regards
andrea