Suppose we have this file:rrows 35 cols 51  spin 2 %band5 efermi=0.0125380.004352  0.004317  0.004213  0.004047  0.003828  0.003570  0.003291  0.0030110.002754  0.002544  0.002408  0.002376  0.002478  0.002742  0.003200  0.0038820.004818  0.006034  0.007560  0.009420  0.011637  0.014209  0.017205  0.0206170.024458  0.028717  0.024458  0.020617  0.017205  0.014209  0.011637  0.0094200.007560  0.006034  0.004818  0.003882  0.003200  0.002742  0.002478  0.0023760.002408  0.002544  0.002754  0.003011  0.003291  0.003570  0.003828  0.0040470.004213  0.004317  0.0043520.004339  0.004087  0.003978  0.003805  0.003576  0.003305  0.003009  0.0027080.002425  0.002184  0.002011  0.001934  0.001979  0.002172  0.002538  0.0030960.003855  0.004930  0.006453  0.008311  0.010524  0.013114  0.016097  0.0194880.023300  0.027520  0.023300  0.019488  0.016096  0.013113  0.010523  0.0083100.006452  0.004928  0.003856  0.003097  0.002539  0.002173  0.001979  0.0019340.002012  0.002185  0.002426  0.002709  0.003009  0.003305  0.003576  0.0038050.003979  0.004088  0.004339rrows 35 cols 51  spin 2 %band7 efermi=0.012538-0.083687 -0.083837 -0.084283 -0.085015 -0.086017 -0.087265 -0.088733 -0.090386-0.092190 -0.094103 -0.096082 -0.098082 -0.100055 -0.101950 -0.103713 -0.105283-0.106592 -0.107556 -0.108073 -0.108026 -0.107336 -0.106094 -0.106755 -0.107283-0.106405 -0.108146 -0.106406 -0.107280 -0.106757 -0.106094 -0.107335 -0.108024-0.108070 -0.107553 -0.106589 -0.105280 -0.103710 -0.101947 -0.100052 -0.098079-0.096079 -0.094100 -0.092187 -0.090384 -0.088731 -0.087264 -0.086016 -0.085014-0.084283 -0.083837 -0.083687-0.085767 -0.085905 -0.086315 -0.086988 -0.087910 -0.089061 -0.090418 -0.091950-0.093626 -0.095410 -0.097264 -0.099147 -0.101017 -0.102829 -0.104540 -0.106099-0.107455 -0.108548 -0.109305 -0.109631 -0.109407 -0.108549 -0.107204 -0.105849-0.106353 -0.108175 -0.106354 -0.105851 -0.107205 -0.108549 -0.109406 -0.109630-0.109304 -0.108546 -0.107453 -0.106097 -0.104537 -0.102827 -0.101015 -0.099145-0.097262 -0.095409 -0.093625 -0.091949 -0.090417 -0.089060 -0.087909 -0.086987-0.086314 -0.085905 -0.085767rrows 35 cols 51  spin 2 %band9 efermi=0.012538-0.061113 -0.061436 -0.062390 -0.063941 -0.066032 -0.068592 -0.071540 -0.074790-0.078249 -0.081826 -0.085425 -0.088945 -0.092274 -0.095281 -0.097398 -0.099381-0.100501 -0.101364 -0.104053 -0.105697 -0.106070 -0.105020 -0.103471 -0.105104-0.106376 -0.107276 -0.106378 -0.105107 -0.103474 -0.105024 -0.106076 -0.105700-0.104061 -0.101373 -0.100495 -0.099380 -0.097396 -0.095273 -0.092266 -0.088937-0.085418 -0.081819 -0.078243 -0.074784 -0.071535 -0.068587 -0.066028 -0.063938-0.062388 -0.061435 -0.061113-0.067212 -0.067480 -0.068275 -0.069570 -0.071323 -0.073481 -0.075980 -0.078749-0.081714 -0.084796 -0.087914 -0.090982 -0.093903 -0.096572 -0.098857 -0.100599-0.101611 -0.101720 -0.104006 -0.106581 -0.107862 -0.107418 -0.105241 -0.104975-0.106487 -0.107607 -0.106490 -0.104977 -0.105243 -0.107422 -0.107868 -0.106588-0.104013 -0.101715 -0.101604 -0.100592 -0.098850 -0.096565 -0.093896 -0.090975-0.087908 -0.084790 -0.081708 -0.078744 -0.075975 -0.073477 -0.071320 -0.069567-0.068273 -0.067479 -0.067212TO    file1:0.004352  0.004317  0.004213  0.004047  0.003828  0.003570  0.003291  0.0030110.002754  0.002544  0.002408  0.002376  0.002478  0.002742  0.003200  0.0038820.004818  0.006034  0.007560  0.009420  0.011637  0.014209  0.017205  0.0206170.024458  0.028717  0.024458  0.020617  0.017205  0.014209  0.011637  0.0094200.007560  0.006034  0.004818  0.003882  0.003200  0.002742  0.002478  0.0023760.002408  0.002544  0.002754  0.003011  0.003291  0.003570  0.003828  0.0040470.004213  0.004317  0.0043520.004339  0.004087  0.003978  0.003805  0.003576  0.003305  0.003009  0.0027080.002425  0.002184  0.002011  0.001934  0.001979  0.002172  0.002538  0.0030960.003855  0.004930  0.006453  0.008311  0.010524  0.013114  0.016097  0.0194880.023300  0.027520  0.023300  0.019488  0.016096  0.013113  0.010523  0.0083100.006452  0.004928  0.003856  0.003097  0.002539  0.002173  0.001979  0.0019340.002012  0.002185  0.002426  0.002709  0.003009  0.003305  0.003576  0.0038050.003979  0.004088  0.004339file2:-0.083687 -0.083837 -0.084283 -0.085015 -0.086017 -0.087265 -0.088733 -0.090386-0.092190 -0.094103 -0.096082 -0.098082 -0.100055 -0.101950 -0.103713 -0.105283-0.106592 -0.107556 -0.108073 -0.108026 -0.107336 -0.106094 -0.106755 -0.107283-0.106405 -0.108146 -0.106406 -0.107280 -0.106757 -0.106094 -0.107335 -0.108024-0.108070 -0.107553 -0.106589 -0.105280 -0.103710 -0.101947 -0.100052 -0.098079-0.096079 -0.094100 -0.092187 -0.090384 -0.088731 -0.087264 -0.086016 -0.085014-0.084283 -0.083837 -0.083687-0.085767 -0.085905 -0.086315 -0.086988 -0.087910 -0.089061 -0.090418 -0.091950-0.093626 -0.095410 -0.097264 -0.099147 -0.101017 -0.102829 -0.104540 -0.106099-0.107455 -0.108548 -0.109305 -0.109631 -0.109407 -0.108549 -0.107204 -0.105849-0.106353 -0.108175 -0.106354 -0.105851 -0.107205 -0.108549 -0.109406 -0.109630-0.109304 -0.108546 -0.107453 -0.106097 -0.104537 -0.102827 -0.101015 -0.099145-0.097262 -0.095409 -0.093625 -0.091949 -0.090417 -0.089060 -0.087909 -0.086987-0.086314 -0.085905 -0.085767And so on.PS: rrows 35 cols 51  spin 2 %band9 efermi=0.012538 are one in line. I want to extract the lines/columns between two rrows 35 cols 51  spin 2 %band9 efermi=0.012538 rrows 35 cols 51  spin 2 %band10 efermi=0.012538I wrote a command like this :~$ awk '{for(i=2;i<=NF;i++) {awk 'NR >= i && NR <= i+2' <bnds.fe >out_$i'};printf out_$i}'which failed. Could you help me on this?Thanks
how to extract lines between 2 patterns, and save them to different files
bash;sed;awk
Using awk:< input awk '/^rrows/ {i++; next} {print >> filei}'