[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] How to extract certain column



lina wrote:
Hi,

Sorry for off-topic, but I do need some suggestions now,

Here it's

   #  RAAADUE AA STBBCCCRE BP1 BP2  ACC     N-H-->O    O-->H-N
N-H-->O    O-->H-N    TCO  KAPPA DDPHA  PAI   PZI    X-CA   Y-CA
Z-CA
     1  174   V              0   0    0      0, 0.0    11,-0.3     0,
0.0     9,-0.1   0.000 360.0 360.0 360.0 155.8   21.7   42.5   31.0
     2  175   H        -     0   0    0      9,-2.2     7,-0.7
1,-0.1     2,-0.1  -0.345 360.0-101.3 -55.9 135.5   19.9   41.2   27.8


What if I only interested what under the N-H-->0?

How to took this column out.

It doesn't have a fixed Field No, (not matter from the left or right).
So I don't know how to get it by awk.


Let's radically trim your example to get rid of line wrapping artifacts.

   #  RAAADUE AA STBBCCCRE BP1 BP2  ACC     N-H-->O    O-->H-N
     1  174   V              0   0    0      0, 0.0    11,-0.3
     2  175   H        -     0   0    0      9,-2.2     7,-0.7

From this it would appear (assuming all white-space is space character) that one could search the heading for appropriate label (i.e. "N-H-->0") returning its position (N). Then search for next non-space character following a space returning the position of the last space character (M). Then for each line return the sub-string from character N->M, trimming as desired.

What that would be in awk I have no idea as I've never used awk.
HTH





Reply to: