I have an input file with this general structure. I only want to extract the values step and weight from the hill blocks and put them into a output file using awk/sed/grep. Hill blocks are arranged in similar fashion throughout in the input file.
Edit : I am using MAC OSX.
configuration {
step 5000
dt 2.000000e+00
}
colvar {
name d1
x 1.70882305580118e+01
v 0.00000000000000e+00
}
1.85104129628346e-02 9.71380137561312e-02 4.00538287370335e-02
1.25662994200839e-02 9.88655406140091e-02 1.41657757894898e-01
hill {
step 0
weight 1.00000000000000e-01
centers 1.23563844380284e+02
widths 1.25331413731550e+00
}
hill {
step 100
weight 1.00000000000000e-01
centers 1.19065310650377e+02
widths 1.25331413731550e+00
}
Through some other answers I manage to found some help :-
sed 's/^.*weight//' diol_colvar.colvars.state > hill.txt
sed 's/^.*step//' diol_colvar.colvars.state > hill.txt
Sadly this is not working as I wanted.
I want my output something like this :-
0 1.00000000000000e-01
100 1.00000000000000e-01
Please help me sort this issue.
Thanks,
hill
blocks and put the values side by side? is that correct? – Sundeep Sep 03 '16 at 09:06step
andweight
are guaranteed to be next to each other? is there a chance of them appearing next to each other outsidehill
blocks? – Sundeep Sep 03 '16 at 09:23