10-22-2010
How to give a variable output name in a shell script inside a for loop
Hi all
I run my program
prog.c in the following way :
PHP Code:
$ ./prog 1 > output.txt
where
1 is a user defined initial value used by the program.
But now I want to run it for many a thousand initial values, 1-1000, and
store all the outputs in different files.
Like
PHP Code:
$ ./prog 1 > output1.txt
$ ./prog 2 > output2.txt
$ ./prog 3 > output3.txt
.
.
$ ./prog 1000 > output1000.txt
I know how to use the for loop in a shell script
but dont know how to give a variable output name.
Please give me a small example
PLEASE HELP
Regards
Alice
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi all...
I am executing a comman in a shell script but the command needs a user input of character 'y' as input so it stops in between...may i know is there is any way of giving that character as input in the shell script itself???...thanks in advance.... (6 Replies)
Discussion started by: santy
6 Replies
2. Shell Programming and Scripting
Hi All.
I need help for the below logic.
I ve a file like following
input file:
NopTX(5) // should be remain same as input
----Nop(@100); //1
Nop(90); //2
--Nop(80); //3
@Nop(70); //4
--@Nop(60); //5
@Nop@(@50); //6
--Nop@( 40); ... (3 Replies)
Discussion started by: user_prady
3 Replies
3. UNIX for Dummies Questions & Answers
hi,
i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (1 Reply)
Discussion started by: kripssmart
1 Replies
4. Shell Programming and Scripting
hi,
i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (11 Replies)
Discussion started by: kripssmart
11 Replies
5. Shell Programming and Scripting
I have a continous polling happening inside a shell script on AIX. This actually calls a PL/SQL block. Is there a way I can set up a variable or pass an interrupt to end the script gracefully. I cant read from the config once the job starts running. Ideally I should change value of a variable and... (1 Reply)
Discussion started by: kshyju
1 Replies
6. Shell Programming and Scripting
Hi Gurus
I have a file called /tmp/CMDB which looks like this
serial: 0623AN1208
hostname: server1
model: x4100
assetID: 1234
I am writing a for loop that will go through this file line by line creating a variable of itself. Using the first iteration of the loop (i.e. the first line) as... (6 Replies)
Discussion started by: hcclnoodles
6 Replies
7. Shell Programming and Scripting
hi all,
i'm using the following script,
Status=1
Function_do ()
{
while read line;
do
if ; then
#echo $line
if ; then
Status=0
echo " LINKINK ERROR "
fi
fi
done < ldd.log
}
Function_do (4 Replies)
Discussion started by: vij_krr
4 Replies
8. Shell Programming and Scripting
I have an input file at ./$1.txt
with content of seq numbers like :
1234567890
1234589700
.
.
so on..
I need to take each seq nbr from the input file ,run the query below:
select ackname,seqnbr from event where event_text like '%seqnbr( from the input file)'
and redirect the... (11 Replies)
Discussion started by: rkrish
11 Replies
9. Shell Programming and Scripting
I want to create a shell script to add a user and modify its comment field mentioned in a file.
1.
File value:-
username comment field value
xyz123 xyztesting
abc123 abctesting
def123 deftesting
2. i am using below loop to create user... (2 Replies)
Discussion started by: Anil
2 Replies
10. UNIX for Beginners Questions & Answers
I have if loop with multiple variable value check in if loop. How can i print only if loop satisfied variable and its value in shell script ? I dont want to check each variable in if loop. That makes my script larger.
if ]
then
echo "Only satisfied variable with value"
... (3 Replies)
Discussion started by: prince1987
3 Replies
uncat(1) General Commands Manual uncat(1)
NAME
uncat - continuously reads stdin, splits up the data either by timeout or number of bytes read to process it
SYNOPSIS
uncat [-vo] [-t seconds] [-s size] prog
DESCRIPTION
uncat continuously reads stdin and repeatedly processes the data either after seconds timeout or maximal number of bytes size read. To
process the data, uncat starts prog and feeds the data into prog's standard input. prog's standard output is redirected to standard error.
uncat never writes to standard output.
prog consist of one or more arguments.
If prog exits non-zero, uncat prints an error message, discards the data and continues to read stdin.
Note that uncat is not crash proof.
uncat is used to run the socklog-notify service.
OPTIONS
-v verbose. Print verbose messages to stderr.
-o once. Exit on end of input. Normally uncat continues waiting for data on standard input, even on end of file.
-t seconds
timeout. Set the timeout to seconds seconds. Default is 300.
-s size
Set the maximal number of bytes to size. Default is 1024.
SIGNALS
If uncat receives a TERM signal, it starts to process the data in memory and exits as soon as possible.
uncat also does this on end of input if the -o option was given.
EXIT CODES
uncat returns 0 after receiving a TERM signal. uncat returns 111 on error.
SEE ALSO
socklog(8), socklog-conf(8), sv(8), runsv(8), svlogd(8), tryto(1)
http://smarden.org/socklog/
http://smarden.org/runit/
AUTHOR
Gerrit Pape <pape@smarden.org>
uncat(1)