LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-03-2010, 09:10 PM   #1
kswapnadevi
LQ Newbie
 
Registered: Oct 2010
Posts: 16

Rep: Reputation: 0
reset the counter in shell script.


I am executing the following script using 'awk -f process.awk out' where 'out' is the input file which consists of 5000 sequences. Each time it takes one sequence, run the below program by creating a directory, run the mfold command within that directory, running another shell script 'final5' and redirect the output to a file from final5 shell. After that the directory is deleted, taking second sequence from 'out' and repeating this process. It is working well upto 1020 directories. From 1021 it is giving error. After executing this 1000 times, can we reset the counter to 1 in such a way it takes it as directory 1 and start this process for 1001 to 2000 sequences. Similarly I have to reset the counter to five times because input file contains 5000 seqeunces. Shell scripting for this is highly appreciated. Thanks in advance.





Code:
 

process. awk

 

BEGIN {
   FS=">";RS=">";ORS="";
}
$NF { d++
  system("mkdir dir"d);
  print ">"$0 > ("dir"d"/input");
  system("cd dir"d"; mfold SEQ=input");
  system("cd dir"d"; /home/rsankar/bin/mfold SEQ=input");
  system(cd "/home/rsankar/rna/temp");
  system("sh final5");
  system("rm -rf dir"d);
 
Old 12-03-2010, 11:11 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Hasn't grail already suggested a solution to this problem?

BTW the posted awk is incomplete.
 
Old 12-04-2010, 01:46 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
For this one I would wonder why you are bothering to use awk at all seeing everything you wish to do except read the line from the file requires
you to jump out to the system??
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] shell script returning counter value from a while loop - lost upon completion logan960 Programming 2 11-19-2009 06:30 AM
Reset users passwords using shell script rahmad Linux - Newbie 13 09-02-2008 04:04 AM
How do I reset the login counter mccartjd Linux - Newbie 3 05-05-2008 11:00 AM
Shell Script: A Broadcast Packet Counter BigglesZX Programming 12 06-15-2006 02:23 PM
how to reset transmit/receive errors counter? whysyn Linux - Networking 1 05-26-2005 04:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration