Retreiving multiple files by changing a parameter with one program


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Retreiving multiple files by changing a parameter with one program
# 1  
Old 01-17-2013
Retreiving multiple files by changing a parameter with one program

Hi all,
I am using following command:
Code:
perl program.pl input.txt output.txt  CUTOFF 3 > groups_3.txt

containing program.pl, two files (input.txt, output.txt) and getting output in groups_3.txt:

But, I wish to have 30 files corresponding to each CUTOFF ranging from 0 to 30 using the same program.pl, two files (input.txt, output.txt), because with each value of CUTOFF I will get different number of groups in each output file. In other words, I want to call program.pl using input.txt output.txt with different CUTOFF.

Thanks
# 2  
Old 01-17-2013
Try the following from bash

Code:
for VAL in {0..30}
do
    echo "Producing for CUTOFF: $VAL"
    perl program.pl input.txt output.txt  CUTOFF $VAL > groups_$VAL.txt
done

or
Code:
for VAL in `seq 0 30`
do
    echo "Producing for CUTOFF: $VAL"
    perl program.pl input.txt output.txt CUTOFF $VAL > groups_$VAL.txt
done

This User Gave Thanks to Chubler_XL For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Combine and complete multiple CSV files based on 1 parameter

I have to create a new CSV file based on the value listed on the 3rd column from different CSV files. This is what I need: 1. I should substitute the first column from each file, excluding the headers, with the file name InputXX. 2. Then, I need to look for rows with 0 on the third column in... (7 Replies)
Discussion started by: Xterra
7 Replies

2. UNIX for Dummies Questions & Answers

Changing cases of multiple files in different folders

I am a TA for a computer science course and we have a program that flags code that appears to the same as other code that is supplied. In order for the program to check all of the student's programs, the programs all need to be named exactly the same. However, students don't like to follow... (12 Replies)
Discussion started by: bpmawhin
12 Replies

3. UNIX for Dummies Questions & Answers

Rename multiple files in shell bash, changing elements order.

Hi, I want to rename several files like this: example: A0805120817.BHN A0805120818.BHN ..... to: 20120817.0805.N 20120818.0805.N ...... How can i do this via terminal or in shell bash script ? thanks, (6 Replies)
Discussion started by: pintolcv
6 Replies

4. UNIX for Dummies Questions & Answers

Rename multiple files, changing prefix, extension and dropping characters

I'm currently only able to perform some very basic functions, so hope this makes sense... I have a set of about 27 files that need to be renamed from something like this: 000012ABCDEFGHIJ.XXX.YYY.ZZZ 000078KLMNO.XXX.YYY.ZZZ 000099PQ.XXX.YYY.ZZZ to something like this: newa012.abc... (11 Replies)
Discussion started by: bbmcg
11 Replies

5. UNIX for Dummies Questions & Answers

Help with retreiving files' information stored in different directories.

Dear All, I have a question. I have similarly named files stored in different directories and I'd like to retreive information from them remotely to perform other tasks. For example given: Folder 5 has files S5_SK1.chr01 S5_SK1.chr02 ....... Folder 6 has files S6_SK1.chr01 ... (3 Replies)
Discussion started by: pawannoel
3 Replies

6. Programming

Control multiple program instances - open multiple files problem

Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine. So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files. My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Discussion started by: hakermania
3 Replies

7. Shell Programming and Scripting

Renaming multiple files, specifically changing their case

Hey all, I'm running a BASH shell and I was wondering if anyone knows a code to rename all the files in a directory. All I need to do is change the first character in the file from uppercase to lowercase and some of the files are already lowercase so they don't need to change. -Thanks (4 Replies)
Discussion started by: jjzieve
4 Replies

8. Shell Programming and Scripting

Changing a string in multiple files

New to scripting and unix. Would like to know how to change a string in a file. eg: From network=/usr/spool/progs/ to network=/spool/progs/ In multiple files. (4 Replies)
Discussion started by: smcraesun
4 Replies

9. Shell Programming and Scripting

Create Multiple files by reading a input file and changing the contents

Being new to this area .I have been assigned a task which i am unable to do . Can any one please help me . Hi I have requirement where i have input file XYZ_111_999_YYYYMMDD_1.TXT and with header and series of Numbers and Footer. I want to create a mutiple output files with each file having a... (2 Replies)
Discussion started by: bhargavkr
2 Replies

10. UNIX for Dummies Questions & Answers

changing extensions for multiple files at once

I copied some files to another folder, and I want to change them from .doc extensions to .txt extensions. I tried using the cp and mv commands, but it didn't work. Is it possible to change file extensions with these commands, and if so how do I do it? I tried using the * wildcard (say cp *.doc... (1 Reply)
Discussion started by: Straitsfan
1 Replies
Login or Register to Ask a Question