Sponsored Content
Top Forums Shell Programming and Scripting Bash for loop with two variables Post 302852487 by in2nix4life on Wednesday 11th of September 2013 04:20:56 PM
Old 09-11-2013
Code:
for x in $(ls TST*);do i=${x:3:3} j=${x:7:6};echo $i $j;done
500 1000
500 2000
500 3000
700 1000
700 2000
700 3000
900 1000
900 2000
900 3000

This User Gave Thanks to in2nix4life For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using variables outside a while loop

Hi Guys, I have a scripts that uses a while loop to read a file and set 2 variables. How can I do this so the variables can be used outside the while loop ? Below is an example....# ./junk2 -m -e user EXE=user master=TRUE DB_TAG=PRODUCT In loop MST=MST=testsvr1:3110 In loop ARGS=... (2 Replies)
Discussion started by: Tornado
2 Replies

2. Shell Programming and Scripting

bash and ksh: variable lost in loop in bash?

Hi, I use AIX (ksh) and Linux (bash) servers. I'm trying to do scripts to will run in both ksh and bash, and most of the time it works. But this time I don't get it in bash (I'm more familar in ksh). The goal of my script if to read a "config file" (like "ini" file), and make various report.... (2 Replies)
Discussion started by: estienne
2 Replies

3. Shell Programming and Scripting

Is there a better way I could have run this loop. (For loop with two variables)

Sorry for such a dreadful title, but I'm not sure how to be more descriptive. I'm hoping some of the more gurutastic out there can take a look at a solution I came up with to a problem, and advice if there are better ways to have gone about it. To make a long story short around 20K pieces of... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

4. Shell Programming and Scripting

Using variables created sequentially in a loop while still inside of the loop [bash]

I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends. As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

5. Shell Programming and Scripting

BASH loop inside a loop question

Hi all Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Discussion started by: rethink
4 Replies

6. Shell Programming and Scripting

BASH arrays and variables of variables in C++

Sometimes it is handy to protect long scripts in C++. The following syntax works fine for simple commands: #define SHELLSCRIPT1 "\ #/bin/bash \n\ echo \"hello\" \n\ " int main () { cout <<system(SHELLSCRIPT1); return 0; } Unfortunately for there are problems for: 1d arrays:... (10 Replies)
Discussion started by: frad
10 Replies

7. Shell Programming and Scripting

Bash for loop with awk and variables

I'm relatively new to bash scripting and am trying to use awk inside a bash for loop but am having a problem with the variables. for i in $(seq 30 5 60) do # Define variables up and down in AWK eval $(awk 'BEGIN{ print "up=$((i+1))"}' < /dev/null) eval $(awk 'BEGIN{ print... (2 Replies)
Discussion started by: lily-anne
2 Replies

8. Shell Programming and Scripting

Passing awk variables to bash variables

Trying to do so echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies

9. Shell Programming and Scripting

awk to create variables to pass into a bash loop to create a download link

I have created one file that contains all the necessary info in it to create a download link. In each of the lines /results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67... (8 Replies)
Discussion started by: cmccabe
8 Replies

10. UNIX for Beginners Questions & Answers

Bash array variables are changed in loop runtime

I am trying to check whether particular host and port are responding or not. I am using below script to check. but node_port array that i am using in loop is getting replaced with previous iteration value. Script and output is given. Please help me to understanding why node_port values are... (5 Replies)
Discussion started by: tmalik79
5 Replies
priority.h(3)							       log4c							     priority.h(3)

NAME
priority.h - The priority class provides importance levels with which one can categorize log messages. SYNOPSIS
#include <log4c/defs.h> Enumerations enum log4c_priority_level_t { LOG4C_PRIORITY_FATAL = 000, LOG4C_PRIORITY_ALERT = 100, LOG4C_PRIORITY_CRIT = 200, LOG4C_PRIORITY_ERROR = 300, LOG4C_PRIORITY_WARN = 400, LOG4C_PRIORITY_NOTICE = 500, LOG4C_PRIORITY_INFO = 600, LOG4C_PRIORITY_DEBUG = 700, LOG4C_PRIORITY_TRACE = 800, LOG4C_PRIORITY_NOTSET = 900, LOG4C_PRIORITY_UNKNOWN = 1000 } Functions LOG4C_API const char * log4c_priority_to_string (int a_priority) LOG4C_API int log4c_priority_to_int (const char *a_priority_name) Detailed Description The priority class provides importance levels with which one can categorize log messages. Enumeration Type Documentation enum log4c_priority_level_t Predefined Levels of priorities. These correspond to the priority levels used by syslog(3). Enumerator: LOG4C_PRIORITY_FATAL fatal LOG4C_PRIORITY_ALERT alert LOG4C_PRIORITY_CRIT crit LOG4C_PRIORITY_ERROR error LOG4C_PRIORITY_WARN warn LOG4C_PRIORITY_NOTICE notice LOG4C_PRIORITY_INFO info LOG4C_PRIORITY_DEBUG debug LOG4C_PRIORITY_TRACE trace LOG4C_PRIORITY_NOTSET notset LOG4C_PRIORITY_UNKNOWN unknown Function Documentation LOG4C_API int log4c_priority_to_int (const char *a_priority_name) Parameters: a_priority_name a priority string name. Returns: the given numeric value of the priority. References LOG4C_PRIORITY_UNKNOWN. LOG4C_API const char* log4c_priority_to_string (inta_priority) Parameters: a_priority a numeric value of the priority. Returns: the given priority string name. Author Generated automatically by Doxygen for log4c from the source code. Version 1.2.1 Mon May 2 2011 priority.h(3)
All times are GMT -4. The time now is 05:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy