nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Script to extract some part of files:

This is a discussion on Script to extract some part of files: within the Shell scripting forums, part of the Development/Scripting category; Hi all! I am working on Linux Platform. I am in very much need to separate out my files according ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 03-13-2007, 06:30 PM
Junior Member
 
Join Date: Mar 2007
Posts: 1
Rep Power: 0
satish1482
Default Script to extract some part of files:

Hi all!

I am working on Linux Platform.
I am in very much need to separate out my files according to the information given in another file.I am giving you the format of each file here and than I will desribe what output actually I need.

This is my File no. 1:


Column starting from > mark represent the following:
>Serial number of nucleotides
----->Residue number as in PDB
---------->Residue name
------------->Chain ID
-------------->Serial number of the paired base
------------------->Residue number of the paired base as in PDB
------------------------>Residue name of the paired base
--------------------------->Chain ID of the paired base
----------------------------->Base pair type
---------------------------------->Base pair indicator
------------------------------------->E-value indicating base pair deformation
----------------------------------------->Equivalent information for other pairs
1 601 U R 71 672 A R W:WC BP 0.01
2 602 C R 70 671 G R W:WC BP 0.08
3 603 C R 69 670 G R W:WC BP 0.04
4 604 G R 68 669 C R W:WC BP 0.04
5 605 U R 67 668 G R W:WC BP 0.15
6 606 G R 66 667 C R W:WC BP 0.05
7 607 A R 65 666 U R W:WC BP 0.04
8 608 U R 14 614 A R W:HT BP 0.24
9 609 A R 23 623 A R H:HT BP 0.02
10 610 G R 25 625 U R W:WC BP 0.15
11 611 U R 24 624 A R W:WC BP 0.08
12 612 U R 23 623 A R W:WC BP 0.06
13 613 U R 22 622 G R W:WT BP 0.09
14 614 A R 8 608 U R H:WT BP 0.24
15 615 A R 47 648 U R W:WT BP 0.03
16 616 U R 58 659 U R 2:2T BP 0.59
17 617 G R
18 618 G R 55 656 C R W:WC BP 0.14
19 619 U R
20 620 C R
21 621 A R
22 622 G R 13 613 U R W:WT BP 0.09 46 646 A R H:+T TP 0.15
23 623 A R 9 609 A R H:HT BP 0.02 12 612 U R W:WC TP 0.06
24 624 A R 11 611 U R W:WC BP 0.08
25 625 U R 10 610 G R W:WC BP 0.15
26 626 G R 44 644 A R W:WC BP 0.18
27 627 G R 43 643 C R W:WC BP 0.03
28 628 G R 42 642 C R W:WC BP 0.03
29 629 C R 41 641 G R W:WC BP 0.00
30 630 G R 40 640 U R W:WC BP 0.04
31 631 C R 39 639 G R W:WC BP 0.04

and... here is file 2:

ATOM 3948 O3P U R 601 87.443 56.290 -33.341 1.00 68.37 1ASY4244
ATOM 3949 P U R 601 86.329 55.822 -34.357 1.00 69.36 1ASY4245
ATOM 3950 O1P U R 601 85.172 55.252 -33.617 1.00 70.90 1ASY4246
ATOM 3951 O2P U R 601 86.854 54.828 -35.356 1.00 71.50 1ASY4247
ATOM 3952 O5* U R 601 85.845 57.094 -35.175 1.00 63.25 1ASY4248
ATOM 3953 C5* U R 601 85.151 56.948 -36.433 1.00 55.85 1ASY4249
ATOM 3954 C4* U R 601 84.563 58.263 -36.846 1.00 51.42 1ASY4250
ATOM 3955 O4* U R 601 83.911 58.892 -35.718 1.00 49.27 1ASY4251
ATOM 3956 C3* U R 601 85.698 59.228 -37.191 1.00 49.91 1ASY4252
ATOM 3957 O3* U R 601 85.992 59.082 -38.595 1.00 51.35 1ASY4253
ATOM 3958 C2* U R 601 85.046 60.587 -36.933 1.00 47.11 1ASY4254
ATOM 3959 O2* U R 601 84.247 60.953 -38.052 1.00 46.28 1ASY4255
ATOM 3960 C1* U R 601 84.163 60.295 -35.727 1.00 46.00 1ASY4256
ATOM 3961 N1 U R 601 84.731 60.719 -34.426 1.00 43.00 1ASY4257
ATOM 3962 C2 U R 601 84.878 62.078 -34.176 1.00 42.61 1ASY4258
ATOM 3963 O2 U R 601 84.605 62.926 -35.029 1.00 47.96 1ASY4259
ATOM 3964 N3 U R 601 85.298 62.429 -32.927 1.00 39.71 1ASY4260
ATOM 3965 C4 U R 601 85.614 61.581 -31.911 1.00 40.20 1ASY4261
ATOM 3966 O4 U R 601 85.992 62.005 -30.809 1.00 39.70 1ASY4262
ATOM 3967 C5 U R 601 85.446 60.193 -32.230 1.00 41.95 1ASY4263
ATOM 3968 C6 U R 601 85.025 59.813 -33.444 1.00 42.69 1ASY4264
ATOM 3969 P C R 602 87.506 58.907 -39.120 1.00 58.39 1ASY4265
ATOM 3970 O1P C R 602 88.347 58.249 -38.078 1.00 57.73 1ASY4266


Now, this is just the part of my file.
So, I am interseted to fetch out the whole part from file 2 which is in series as it is there in file1...example 601,602,603.In another words, I m looking for the whole part from file 2: as example if there is "601 U R " in file 1, I need everything from file 2 which comprises of 601 U R and other things like
ATOM 3948 O3P U R 601 87.443 56.290 -33.341 1.00 68.37 1ASY4244.
PLEASE SOLVE THIS PROBLEM FOR ME BY WRITING A CODE AS THERE IS WHOLE LOT OF FILES LIKE THIS.

Thnks in advance.
Reply With Quote
Sponsored Links
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Sun Certified System Administrator for the Solaris 10 OS, Part I (CX-310-200) nkechifesie Solaris/OpenSolaris 8 02-18-2008 02:44 PM
Shell script for automatic conversion of files in tar files kasimani Shell scripting 2 02-08-2007 04:45 PM
FreeBSD setup ACL or Access control list tutorial part # 1 nixcraft Getting started tutorials 2 12-20-2006 02:55 AM
how to extract zip files in linux Linux software 1 01-11-2006 12:30 AM
Script to extract a specific row of data ricc Shell scripting 1 11-15-2005 03:29 PM


All times are GMT +5.5. The time now is 07:21 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36