Selecting files from a list and passing them to a program using csh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Selecting files from a list and passing them to a program using csh
Prev   Next
# 1  
Old 11-28-2011
Selecting files from a list and passing them to a program using csh

I have a list of files, example as shown below

Code:
n02-z30-dsr65-ndelt0.25-varp0.002-4x3drw-csq.msf 
n02-z30-dsr65-ndelt0.25-varp0.004-4x3drw-csq.msf 
n02-z30-dsr65-ndelt0.25-varp0.006-4x3drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.008-4x3drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.010-4x3drw-csq.msf
n02-z30-dsr65-ndelt0.75-varp0.002-16x12drw-csq.msf 
n02-z30-dsr65-ndelt0.75-varp0.004-16x12drw-csq.msf 
n02-z30-dsr65-ndelt0.75-varp0.006-16x12drw-csq.msf
n02-z30-dsr65-ndelt0.75-varp0.008-16x12drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.002-16x12drw-csq.msf 
n02-z30-dsr65-ndelt0.25-varp0.004-16x12drw-csq.msf 
n02-z30-dsr65-ndelt0.25-varp0.006-16x12drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.008-16x12drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.010-16x12drw-csq.msf

I need to arrange them in a way that the only difference is the varp tag


For example, the section below have the same file name, except with
different values of varp. They all should be together and passed to a
program called plotmsf

Code:
n02-z30-dsr65-ndelt0.25-varp0.002-4x3drw-csq.msf 
n02-z30-dsr65-ndelt0.25-varp0.004-4x3drw-csq.msf 
n02-z30-dsr65-ndelt0.25-varp0.006-4x3drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.008-4x3drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.010-4x3drw-csq.msf

Example

Code:
./plotlog n02-z30-dsr65-ndelt0.25-varp0.002-4x3drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.004-4x3drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.006-4x3drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.008-4x3drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.010-4x3drw-csq.msf

Thus the list of files should be arranged as shown below:

Code:
n02-z30-dsr65-ndelt0.25-varp0.002-4x3drw-csq.msf 
n02-z30-dsr65-ndelt0.25-varp0.004-4x3drw-csq.msf 
n02-z30-dsr65-ndelt0.25-varp0.006-4x3drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.008-4x3drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.010-4x3drw-csq.msf

n02-z30-dsr65-ndelt0.75-varp0.002-16x12drw-csq.msf 
n02-z30-dsr65-ndelt0.75-varp0.004-16x12drw-csq.msf 
n02-z30-dsr65-ndelt0.75-varp0.006-16x12drw-csq.msf
n02-z30-dsr65-ndelt0.75-varp0.008-16x12drw-csq.msf

n02-z30-dsr65-ndelt0.25-varp0.002-16x12drw-csq.msf 
n02-z30-dsr65-ndelt0.25-varp0.004-16x12drw-csq.msf 
n02-z30-dsr65-ndelt0.25-varp0.006-16x12drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.008-16x12drw-csq.msf
n02-z30-dsr65-ndelt0.25-varp0.010-16x12drw-csq.msf

Then I want to have something as below.

Code:
./plotlog n02-z30-dsr65-ndelt0.25-varp0.002-4x3drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.004-4x3drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.006-4x3drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.008-4x3drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.010-4x3drw-csq.msf


./plotlog n02-z30-dsr65-ndelt0.75-varp0.002-16x12drw-csq.msf \
n02-z30-dsr65-ndelt0.75-varp0.004-16x12drw-csq.msf \
n02-z30-dsr65-ndelt0.75-varp0.006-16x12drw-csq.msf \
n02-z30-dsr65-ndelt0.75-varp0.008-16x12drw-csq.msf


./plotlog n02-z30-dsr65-ndelt0.25-varp0.002-16x12drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.004-16x12drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.006-16x12drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.008-16x12drw-csq.msf \
n02-z30-dsr65-ndelt0.25-varp0.010-16x12drw-csq.msf

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Passing argument to a program!!

Hi friends, I have a small query, hope u will help me with it. I want to write a small program which would take an integer as an argument, then I want to save that argument in a variable of type int. Could you please help me with it. Here is my program #include <stdio.h> int main(int... (4 Replies)
Discussion started by: gabam
4 Replies

2. Shell Programming and Scripting

Passing arguments to csh

I have noticed this thing using csh when passing arguments Suppose I call a csh script using ../Scripts/plot-model.csh -vmod="npt02-z30.vmod" -R="0/80/0/30" -c="0/4.5" -aspr="1:10" Somehow the " get removed when doing $argv ending up with -vmod=npt02-z30.vmod... (0 Replies)
Discussion started by: kristinu
0 Replies

3. Shell Programming and Scripting

Running a program using csh

I have a program which I can run on the command line like below and works fine /nethome/chrisd/HSeis/TommyCD/TommyCD-1101/bin/raytrac vmod=npt10-z30.vmod srfile=jcdint.sc rcfile=jcdint.rc phases="SP FS" level=twop format="X T" dtau=0.1 mdacc=0.5 mindist=0.1 maxitertp=25 ray=npt10-z30.ry... (0 Replies)
Discussion started by: kristinu
0 Replies

4. Shell Programming and Scripting

Passing screen value to a program

Hi all, I have the following question. Apparently not very difficult, but I'm not any expert. I have a program, let's say program.x, and a bash script that execute it, let's say program.sh. When the program executes it asks for a value to continue. What I want is just passing the value throw... (2 Replies)
Discussion started by: josegr
2 Replies

5. Shell Programming and Scripting

Selecting certain times from a list

Hi all, I have a list of times: ...10:02 15:34 20:05 01:51 06:55 09:00 05:52... That's just part of the list (its huge). How do I go about selecting certain times, e.g. just between 23:00 and 05:00 ?? (4 Replies)
Discussion started by: mikejreading
4 Replies

6. UNIX for Dummies Questions & Answers

Selecting Unique Values from many List

I have a question I have like 19 different list which contains the name of the server but what I need is just unique ones. First thing I need to do is just make a unique list within the list itself i.e. delete anything that is repeated inside the list like for example in list1 i... (1 Reply)
Discussion started by: pareshan
1 Replies

7. Shell Programming and Scripting

Selecting one file from a list

Hi, I am able to do this by brute force but I am just curious if there is a better way of handling things. Basically the scenario is something like this: There are a number of files in a directory: rib.20071224.1759.gz 24-Dec-2007 17:59 132K rib.20071224.1959.gz 24-Dec-2007... (7 Replies)
Discussion started by: Legend986
7 Replies

8. Shell Programming and Scripting

how to call awk in a csh Program

Hi Friends, Could you pleas help me out.. I have an awk program which works fine while running it in the command prompt. The awk program is =============== awk 'BEGIN { format="head -%d M2_Sales_N01.txt |tail -%d >M2_Sales_N01_%02d.txt\n" n=0 m=0 } { if (n==0) { tmp=$1 n=1 }... (5 Replies)
Discussion started by: bikas_jena
5 Replies

9. Shell Programming and Scripting

Passing value to an external program problem...

This code is in my 'case' statement and it all else works fine. The problem I have is that the value in 'procno' is not passed on to the external program (fireit). It is passing all zeros instead of the actual process number. By the time I get to this case statement, I know the "Number" and... (1 Reply)
Discussion started by: giannicello
1 Replies

10. Shell Programming and Scripting

Passing the password in csh ( su )

Hi, How do I pass the password from a csh script when I su to a different user ? ( Root is not running this script ) Thanks (1 Reply)
Discussion started by: ayeger
1 Replies
Login or Register to Ask a Question