2

I have a problem. This is small fragment of my input

75747  175810  175813  175831  175840  175852  176068  176095  176149  176215  176260  176290
 176296  176350  176392  176419  176485  176491  176539  176752  176764  176800  176845  176938  176965  177073  177079
 177097  177103  177139  177190  177205  177211
[ hbonds_Other-resname_SOL_and_y_>_1.131_and_y_<_10.112_and_z_>_3.156_and_z_<_8.555_f0_t838800.000 ]
  29033  29034 170302
  29037  29038 125716
  29041  29042 125566

This would be my output

  29033  29034 170302
  29037  29038 125716
  29041  29042 125566

I have 100 files. I want to print lines only after a specific line:

[ hbonds_Other-resname_SOL_and_y_>_1.131_and_y_<_10.112

This line could be different in some files, but the first part is always the same This is the same part

[ hbonds_Other-resname_SOL_and_y_>_1.131_and_y_<_10.112

These lines in different files file1

[ hbonds_Other-resname_SOL_and_y_>_1.131_and_y_<_10.112_and_z_>_3.156_and_z_<_8.555_f0_t838800.000 ]

file2

[ hbonds_Other-resname_SOL_and_y_>_1.131_and_y_<_10.112_or_x_>_3.156_and_x_<_8.555_f0_t863800.000 ]

In the past I use this script to print the lines

#!/bin/bash
old_index=1
for index in {1..100}
do
    awk '{if (NR>=18000) print}' eq2_15_333_$old_index.ndx > eq3_15_333_$index.ndx
    old_index=$(($old_index+1))
done

But In the past I have this line always in the same position, but now I have for example in 18539 line, in another 17564 line etc.

So I think that I could use probably pattern like that awk '$1 ~ /^[ hbonds_Other-resname_SOL_and_y_>_1.131_and_y_<_10.112/', but how to print line after this pattern??????

Jakub
  • 679
  • 5
  • 16
  • 2
    Yes perfect, thank you so much - I use awk 'f;/acceptors_resname_SOL/{f=1}' eq3_15_333_97.ndx | tee new.ndx – Jakub May 18 '20 at 09:33

0 Answers0