English 中文(简体)
a. 配对模式和印刷后线
原标题:match a pattern and print subsequent lines

姓名为200份档案 如:

ATOM      1  N   VAL     1       8.897 -21.545  -7.276  1.00  0.00
ATOM      2  H1  VAL     1       9.692 -22.015  -6.868  1.00  0.00
ATOM      3  H2  VAL     1       9.228 -20.766  -7.827  1.00  0.00
ATOM      4  H3  VAL     1       8.289 -22.236  -7.693  1.00  0.00
TER
ATOM      5  CA  VAL     1       8.124 -20.953  -6.203  1.00  0.00
ATOM      6  HA  VAL     1       8.072 -19.874  -6.345  1.00  0.00
ATOM      7  CB  VAL     1       6.693 -21.515  -6.176  1.00  0.00
ATOM      8  HB  VAL     1       6.522 -22.024  -5.227  1.00  0.00
ATOM      9  CG1 VAL     1       5.684 -20.370  -6.330  1.00  0.00
ATOM     10 1HG1 VAL     1       5.854 -19.861  -7.279  1.00  0.00

i 必须在词汇后提取部分,并放在不同的档案中......所有200份档案都必须这样做。 我做了一些事情,例如sed 1,/TER/d file1_0.pdb > 1_0.pdb。 但是,这将在一时完成一个档案的工作......如果在一站就找到了所有200份档案的解决办法......产出档案中只把“File”从名称中删除。

最佳回答
for i in *.pdb; do sed  1,/TER/d  $i > ${i/File/}; done
问题回答

这一工作可以:

seq 0 200| xargs -i -n1 cp File1_{}.pdb 1_{}.pbd # backup files   
sed -si  1,/TER/d  1_{0..200}.pdb                # edit files separately inline




相关问题
Choosing the right subclass to instantiate programmatically

Ok, the context is some serialization / deserialization code that will parse a byte stream into an object representation that s easier to work with (and vice-versa). Here s a simplified example ...

Design pattern for managing queues and stacks?

Is there a design pattern for managing a queue or a stack? For example, we are looking to manage a list of tasks. These tasks will be added to a group queue, users will then be able to pull off the ...

Organizing classes using the repository design pattern

I have started upgrading one of our internal software applications, written in ASP.NET Web Forms, and moving to ASP.NET MVC. I am trying to leverage the Repository design pattern for my classes, ...

Misuse of Observer Pattern?

I have a Car object which contains a latitude field and a longitude field. I use the observer pattern so that any time either of these fields change in my application, my car object is notified. I ...

How are Models (in MVC) and DAOs supposed to interact?

How are models and DAOs supposed to interact? I m in the process of putting together a simple login module and I m unsure where to put the "business logic." If I put the logic with the data in the ...

热门标签