perl : how to print after a specific line -
for example, my.txt containts
a b xx c d i want print second line below lines contains xx
i tried
perl -nle 'if(/xx/){$n=$.};print if $.>($n+1)' my.txt but didn't work. print lines.
before $n defined interpreted 0 (zero), meaning $. > 1 printed before xx. might wanted:
perl -nle 'if(/xx/){$n=$.}; print if defined($n) , $. > $n+1' my.txt
Comments
Post a Comment