Partition script output question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Partition script output question
# 1  
Old 06-15-2012
Question Partition script output question

Hello Everyone! I have a file called “cells” with 3 set of #'s, roughly 400+ lines. My current tool "movrcs" grabs the “cells” file, and creates one huge “mov_rcs” script which is a problem. I want the tool to grab 20 lines of the "cells" file at a time, and create separate script files for them, not one huge output script. Any assistance is greatly appreciated!!!! Smilie

omp root> cat cells
Code:
  62 33 34 
  103 44 43 
  104 44 43 
  105 44 43 
  106 44 43 
  107 44 43 
  108 44 43 
  109 44 43 
  110 44 43 
  112 44 43

…Output truncated, there are over 250+ lines

omp root> cat movrcs
Code:
while read cell prim alt
  do
   
  echo "/omp/bin/TICLI -1 move:rcs $cell,altap $alt" >> mov_rcs
  echo "sleep 20" >> mov_rcs
  echo "/omp/bin/TICLI -1 move:rcs $cell,priap $prim" >> mov_rcs
  echo "sleep 40" >> mov_rcs
   
  done < cells

ompeps root> cat mov_rcs
Code:
/omp/bin/TICLI -1 "move:rcs 62,altap" 34
  sleep 60
  /omp/bin/TICLI -1 "move:rcs 62,priap" 33
  sleep 60
  /omp/bin/TICLI -1 "move:rcs 103,altap" 43
  sleep 60
  /omp/bin/TICLI -1 "move:rcs 103,priap" 44
  sleep 60
  /omp/bin/TICLI -1 "move:rcs 104,altap" 43
  sleep 60
  /omp/bin/TICLI -1 "move:rcs 104,priap" 44
  sleep 60
  …..output truncated


Last edited by methyl; 06-15-2012 at 08:29 PM.. Reason: please use code tags; sort out broken html
# 2  
Old 06-15-2012
Please post sample exact expected output, and mention what Opaerating System and version you use, and what Shell your posted code requires.
# 3  
Old 06-15-2012
reply

The sample output has been provided, its called mov_rcs file. See above for my request, thanks!

Code:
root> uname -r
5.10
root> cat /etc/release
                      Solaris 10 10/08 s10s_u6wos_07b SPARC
           Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                            Assembled 27 October 2008


Last edited by Franklin52; 06-16-2012 at 02:17 PM.. Reason: Code tags
# 4  
Old 06-16-2012
Something like this? Create a new script file every 20 lines from the input file. Each output script file contains 40 primary commands and 40 sleep commands. Untested. Output format and sleep values are based on your sample output format not on the original script.

Code:
#!/bin/ksh
counter=0
prefix="mov_rcs"
suffix=1
while read cell prim alt
do
     counter=$(( ${counter} + 1 ))
     if [ ${counter} -gt 20 ]
     then
          suffix=$(( ${suffix} + 1 ))
          counter=0
     fi
     scriptfile="${prefix}.${suffix}"
     echo "/omp/bin/TICLI -1 \"move:rcs $cell,altap\" $alt" > "${scriptfile}" 
     echo "sleep 60" >> "${scriptfile}"
     echo "/omp/bin/TICLI -1 \"move:rcs $cell,priap\" $prim" >> "${scriptfile}"
     echo "sleep 60" >> "${scriptfile}"
done < cells


Last edited by methyl; 06-16-2012 at 05:54 PM.. Reason: repost with correction
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Shrink LVM partition & create new Linux Primary partition

Hello All, I have a Red Hat Linux 5.9 Server installed with one hard disk & 2 Partitions created on it as follows, /boot - Linux Partition & another is LVM - One VG & under that 5-6 Logical volumes(var,opt,home etc). Here my requirement is to take out 1GB of space from LVM ( Any logical... (5 Replies)
Discussion started by: gr8_usk
5 Replies

2. Filesystems, Disks and Memory

Ask concept soft partition vs hard partition

Hi Experts I would like to know different between soft partition concept and hard partition concept on solaris. Here is little explanation between soft partition concept and hard partition concept on solaris. Soft Partition: 1TB total space available in storage in all mapped to the OS to... (2 Replies)
Discussion started by: edydsuranta
2 Replies

3. Solaris

Partition overlaps another partition while creating new parition in solaris

hi all while formatting hard disk i am getting following error. Partition 1 ends at 266338338 It must be between 34 and 143374704. label error: EFI Labels do not support overlapping partitions Partition 8 overlaps partition 1. Warning: error writing EFI. Label failed. I have formatted the... (2 Replies)
Discussion started by: nikhil kasar
2 Replies

4. Shell Programming and Scripting

Shell script output redirection question

OS : AIX 6.1 Shell : Korn in the url https://forums.oracle.com/forums/thread.jspa?threadID=361463&tstart=0 I came across a crontab entry example 00 23 * * 1,3,5 <complete shell script path> 1> <log file> 2>&1 From googling , I gathered that 0 - stdin 1 - stdout 2 - stderr I... (5 Replies)
Discussion started by: polavan
5 Replies

5. Shell Programming and Scripting

Use script to monitor command output question? (like Linux watch)

Hi I want to write a script, help me to monitor command output. This script like Linux "watch" command. Below is my script: # cat watch.sh #!/bin/bash while true do clear echo "command: $*" ( $* ) sleep 2 done Then I run this script below (2 Replies)
Discussion started by: nnnnnnine
2 Replies

6. UNIX for Advanced & Expert Users

partition question

Hi I have an exam question which is below and I am looking for answer of this question: I would appreciate your help. * You are the systems administrator of a mail server that services approximately 3,000 users. 2,000 users access their email via a POP-3 service, while the remaining 1,000... (0 Replies)
Discussion started by: tjay83
0 Replies

7. Shell Programming and Scripting

view partition name using script

Hi All.. Previously i've posted my question regarding this script and i managed to solve the problem but i need to modified my script so it will meet the new requirement. Below is the script and output: -------------------------------------------------------------- -bash-3.00$ more... (5 Replies)
Discussion started by: adzuanamir
5 Replies

8. UNIX for Dummies Questions & Answers

I've created a partition with GNU Parted, how do I mount the partition?

I've created a partition with GNU Parted, how do I mount the partition? The manual information at http://www.gnu.org/software/parted/manual/parted.html is good, but I am sure about how I mount the partition afterwards. Thanks, --Todd (1 Reply)
Discussion started by: jtp51
1 Replies

9. UNIX for Dummies Questions & Answers

understanding logical partition, physical partition

hi, 1) is logical partition the same as physical partition except that one is physical and the other is logical? 2) then it must a one to one ratio? (3 Replies)
Discussion started by: yls177
3 Replies

10. Filesystems, Disks and Memory

Question About Drive Partition

I'm using PartitionMagic's wizard to partition my drive for Linux, and after I get past the first step it asks if I want to screate a seperate Linux Swap Partition. What is a Linux Swap Partition and is something I need/should have? (10 Replies)
Discussion started by: Tradewynd
10 Replies
Login or Register to Ask a Question