Running a program multiple times to search pattern and assign structure


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running a program multiple times to search pattern and assign structure
# 1  
Old 01-27-2013
Running a program multiple times to search pattern and assign structure

Hi all,
I have a big file (n.txt) with following pattern:

Code:
ATOM      1  N    SER A   1     122.392 152.261 138.190  1.00  0.00     N  
ATOM      2  CA  SER A   1     122.726 151.241 139.183  1.00  0.00     C  
TER
ENDMDL
ATOM      1  N    SER A   1     114.207 142.287 135.439  1.00  0.00      N  
ATOM      2  CA  SER A   1     113.667 143.509 134.894  1.00  0.00      C 
TER
ENDMDL

I am using following script to read pattern and assign structure to them using another program st giving 2 output files-fn.str -m.mol:
Code:
pattern_txt=n.txt
npattern=`grep -c ENDMDL $pattern_txt`
echo $npattern patterns. Assigning_structure:
echo $npattern > st_input
seq -w 1 $npattern >> st_input
st $pattern_txt -fn.str -mn.mol

But this script is reading only first pattern and giving structure of that pattern by running st program. I wish to have structure for all patterns.

Please guide.
# 2  
Old 01-28-2013
What are the parameters to st? Does it need other input than the pattern file? So you produced
Code:
cat st_input
2
1
2

- what do you do with it? It is not used anywhere.
This User Gave Thanks to RudiC For This Post:
# 3  
Old 01-28-2013
Thanks.
st is a program that read a pattern and produces 2 files n.str (for summary) and n.mol (detail).
I want st to read each pattern from big file, predict the structure and compile all in one n.str and n.mol
# 4  
Old 01-29-2013
So you need to extract each of the (multi line?) patterns from "big file" and provide it to st? I still don't have the slightest clue what you need, or, what st needs resp., and what st_input is/was for.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pattern search multiple files

#!/usr/bin/ksh a="Run successfully" cd $APPS ls -l *.txt | while read $txt do if then cp $APPS/$txt cp $hist/$txt else rm $APPS/$txt echo "Files has been removed" fi done New in shell script please help me out Around 100 txt files in $APPS dir i want to search pattern from... (8 Replies)
Discussion started by: Kalia
8 Replies

2. Shell Programming and Scripting

awk with multiple pattern search

Want to fetch a column with multiple pattern using awk. How to achieve the same. Tried cat test address : 10.63.20.92/24 address : 10.64.22.93/24 address : 10.53.40.91/24 cat test | awk '{print $3}' |awk -F "/" '{print $1}' 10.63.20.92 10.64.22.93 10.53.40.91 Is there any... (2 Replies)
Discussion started by: Manasa Pradeep
2 Replies

3. Shell Programming and Scripting

Multiple search pattern

Hello :) I have this file cat employee_list Name : jack Gender: m ID : 4512 DOB : 03/27/1980 hire date : 04/23/2012 Nationality: US marital status : single ===================== Name : mick Gender: m ID : 1256 DOB : 03/27/1970 Hire date : 012/10/2011 Nationality: US Marital... (4 Replies)
Discussion started by: Sara_84
4 Replies

4. Shell Programming and Scripting

Sed replace using same pattern repeating multiple times in a line

Sed replace using same pattern repeating multiple times in a line I have text like below in a file: I am trying to replace the above line to following How can I acheive this? I am able to do it if the occurrence is for 1 time: But If I try like below I am getting like this: I have to... (4 Replies)
Discussion started by: sol_nov
4 Replies

5. Shell Programming and Scripting

Running Multiple Times ?

hey mates, I was wondering if someone could assist me with this one, I have couple scripts that I would like to invoke from .sh ( One after another ) Script1 Script2 Script3 Is it possible to run script 2 after script one finished running ? And again start script 3 after script 2... (6 Replies)
Discussion started by: NDxiak
6 Replies

6. Shell Programming and Scripting

running C program to output in multiple locations

Hi Guys, What I am looking at doing is to run a C program in my home directory, but output files in multiple directories BUT not at the same instance. For e.g. 1st instance: Run program.c and output results in path /aaa/bbb/ccc/ 2nd instance: Run program.c again and output results... (9 Replies)
Discussion started by: Jatsui
9 Replies

7. Shell Programming and Scripting

How to assign the Pattern Search string as Input Variable

guys, I need to know how to assing pattern matched string as an input command variable. Here it goes' My script is something like this. ./routing.sh <Server> <enable|disable> ## This Script takes an input <Server> variable from this line of the script ## echo $1 | egrep... (1 Reply)
Discussion started by: raghunsi
1 Replies

8. Shell Programming and Scripting

Avoid script running multiple times by filelock

Sometimes we need a single instance of a script to run at a time. Meaning, the script itself should detects whether any instances of himself are still running and act accordingly. When multiple instances of one script running, it’s easy to cause problems. I’ve ever seen that about 350 instances... (4 Replies)
Discussion started by: edenCC
4 Replies

9. Programming

Search attributes in one structure using the values from another structure

Hello Groups I am trying to find out ways of comparing a value from a 'c' structure to a value in another 'C' structure. the 'C' structure can be a List or liked list as it contains lot many records. if we loop it in both the structures it is going to consume time. I am looking for a simple... (3 Replies)
Discussion started by: dhanamurthy
3 Replies

10. Shell Programming and Scripting

Running same script multiple times concurrently...

Hi, I was hoping someone would be able to help me out. I've got a Python script that I need to run 60 times concurrently (with the number added as an argument each time) via nightly cron. I figured that this would work: 30 1 * * * for i in $(seq 0 59); do $i \&; done However, it seems to... (4 Replies)
Discussion started by: ckhowe
4 Replies
Login or Register to Ask a Question