Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using Shell Script To Loop Program Through Multiple Text Files Post 302567949 by AlphaLexman on Tuesday 25th of October 2011 03:42:44 PM
Old 10-25-2011
Quote:
Originally Posted by Jimmyd24
So in my Fortran program would I have to put $File where I am attempting to open the txt files?
No. The shell will evaluate the variable $FILE and perform Variable Expansion to convert the variable into the actual filename.

If your program can handle arguments, the code would then use Parameter Expansion to evaluate the 1st, 2nd, 3rd argument, etc...

You absolutely shouldn't use the variable $FILE in your fortran code, unless it is defined explicitly.

Also note that shell variables are case sensitive, and that $FILE is NOT the same as $File

How do you execute the fortan program for a single file ??
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

want to run different files under the same program using shell script

suppose have different files 1.1 2.2 3.3 4.4 5.5 All the files have to run under the same command say tr -d '\n' so how to run all the files under the same command by using shell script (3 Replies)
Discussion started by: cdfd123
3 Replies

2. Shell Programming and Scripting

problem accessing Multiple Variables from C Program to a Shell script

program name--test #!/bin/bash output1=`/home/user/a.c` output2=`/home/user/a.c` k=`$output1 + 1` m=`$output2 + 1` echo $k echo $m --------------------------------------------------------------------------- prgram name--a.c #include<stdio.h> int main() (1 Reply)
Discussion started by: sameworld1980
1 Replies

3. Shell Programming and Scripting

Storing the values in text file using while loop in shell script

Hi Frdz while read line do name=`echo $line | cut -d' ' -f 1 ` password=`echo $line | cut -d`-` -f 2` name > logfile.txt password > logfile.txt done < list.txt When it is run, am getting last values in list.txt file only,it is not storing lall the list entry values. How can i... (5 Replies)
Discussion started by: KiranKumarKarre
5 Replies

4. UNIX for Dummies Questions & Answers

Foreach loop to run a perl script on multiple files

Hi, I have thousands of files in a directory that have the following 2 formats: 289620178.aln 289620179.aln 289620180.aln 289620183.aln 289620184.aln 289620185.aln 289620186.aln 289620187.aln 289620188.aln 289620189.aln 289620190.aln 289620192.aln.... and: alnCDS_1.fasta (1 Reply)
Discussion started by: greptastic
1 Replies

5. Shell Programming and Scripting

Shell script to run a python program on multiple entries in a file

Hello I am trying to run a python program using shell script, which takes a single argument from a file. This file has one entry per line : 1aaa 2bbb 3ccc 4ddd 5eee ... ... ... My shell script runs the program, only for the last entry : #!/bin/sh IFS=$'\n' for line in $(cat... (2 Replies)
Discussion started by: ad23
2 Replies

6. Shell Programming and Scripting

Removing matching text from multiple files with a shell script

Hello all, I am in need of assistance in creating a script that will remove a specified block of text from multiple .htaccess files. (roughly 1000 files) I am attempting to help with a project to clean up a linux server that has a series of unwanted url rewrites in place, as well as some... (4 Replies)
Discussion started by: boxx
4 Replies

7. UNIX for Dummies Questions & Answers

Writing a loop to manipulate a script and store it in multiple output files

I have a script where the the 9th line looks like this: $filename=sprintf("250.1chr%d.ped", $N); I want to modify this script 1000 times, changing 250.1chr%d.ped to 250.2chr%d.ped, 250.3chr%.ped.......and so on all the way to 250.1000chr%d.ped and store each output in files called ... (4 Replies)
Discussion started by: evelibertine
4 Replies

8. UNIX for Dummies Questions & Answers

Writing a loop to process multiple input files by a shell script

I have multiple input files that I want to manipulate using a shell script. The files are called 250.1 through 250.1000 but I only want the script to manipulate 250.300 through 250.1000. Before I was using the following script to manipulate the text files: for i in 250.*; do || awk... (4 Replies)
Discussion started by: evelibertine
4 Replies

9. Shell Programming and Scripting

Read files in shell script code and run a C program on those files

HI, I am trying to implement a simple shell script program that does not make use of ls or find commands as they are quite expensive on very large sets of files. So, I am trying to generate the file list myself. What I am trying to do is this: 1. Generate a file name using shell script, for... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

10. Shell Programming and Scripting

Loop through multiple files in bash script

Hi Everybody, I'm a newbie to shell scripting, and I'd appreciate some help. I have a bunch of .txt files that have some unwanted content. I want to remove lines 1-3 and 1028-1098. #!/bin/bash for '*.txt' in <path to folder> do sed '1,3 d' "$f"; sed '1028,1098 d' "$f"; done I... (2 Replies)
Discussion started by: BabyNuke
2 Replies
GPIV_SERIES(1)						      General Commands Manual						    GPIV_SERIES(1)

NAME
gpiv_series - Script for (parallel) processing a series of numbered files. SYNOPSIS
gpiv_series [-a | --arg_n] [-b | --basename FILE] [-e | --ext ext] [-f | --first N] [-l | --last N] [-i | --incr N] [-x|| --prefix] [-h | --help] [-n | --none] [-p | --print] [--pad] "process -key1 ..." DESCRIPTION
gpiv_series processes a series of numbered files. If no parameters are defined at the command line, standard parameters will be used that are defined in the script. Principally, any program or script may be invoked by gpiv_series. "Process" is a string which represents the name of the program to be executed, including eventually command line options and arguments. The file to be processed, as constructed from -b c.s., will be appended to the "process" string. If the program has to be feeded with -f "filename", write -f at the end of the string. When using the parallelised version, mpipython is invoked and the script may be launched with mpirun. The script needs that all input files are accessible on each node by copying all data or by (NFS) mounting the File System containing the input data on each node. This program does not use the parameter resources from libgpiv. Options -a | --arg_n If the process needs the current number in its argument list instead of prepending/appending it to the FILE, the number will be put before (-f) filename in the "process" string. -b | --basename FILE The FILE has to be given without its extension. FILE represents the file name without its number. It is supposed that the leading or ending number in the filename is the counter that will be applied by gpiv_series when processing. -e | --ext EXT add an extension EXT after the filename (without the leading ".") in "process". -f | --first N Defines the counter N of the number at which the analyses starts. Default: 0. -l | --last N The last number N that will be processed. Default: 0. -i | --incr N Increment number with N. Default: 1. This might be useful, for example, if subsequent numbered images are combined for cross-corre- lation with the gpiv_img2gpiv tool. -x | --prefix Use prefix numbering to file basename. -h | --help On-line help. -n | --none Suppresses real execution, only prints the process to stdout. -p | --print Prints the process to be performed on each file to stdout. --pad N Padding a number with N zero's when combining with the filename. SEE ALSO gpivtools NOTES
AUTHOR
Gerber Van der Graaf BUGS
The parallelised script has only been tested with the LAM version of mpipython. 19 Januari 2005 GPIV_SERIES(1)
All times are GMT -4. The time now is 06:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy