Sponsored Content
Top Forums Shell Programming and Scripting Loop counter variable display Post 302069720 by RTM on Tuesday 28th of March 2006 05:18:25 PM
Old 03-28-2006
You can use the following:

echo -n "^[[1;75H $variable"

To put that into your script, you have to use the insert mode of vi - to put in the ESC character of ^[, you have to use Control-V then Control-[.

echo line above will put the variable value at line 1, position 75 IF your TERM is set correctly.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

adding counter to a variable while moving in a loop

The scenario is like this : I need to read records from a file one by one and increment counter1, if a certain field matches with a number say "40"..the script should increment the counter2 and also extract a corresponding field from the same line and adding them one by one and redirecting the the... (5 Replies)
Discussion started by: mady135
5 Replies

2. Shell Programming and Scripting

S# in a for loop - concatenate $(loop counter)

Hi, hope I am posting in the right section. My problem is that I have 2 or more arguments passed and I want to check if the arguments passed exists or not. The first argument should not exist and the remaining others should exist. example: ./shells.sh argument1 argument2 argument3 ... (5 Replies)
Discussion started by: fight4love
5 Replies

3. Shell Programming and Scripting

How to display a counter in shell script?

Hi, I am writing a script which processes large number of files in a directory. I wanto display a counter which increment after processing each file. I am processing each file in a for loop. If I echo a variable with its value increasing with each file, I will get around 5000 lines as output.... (10 Replies)
Discussion started by: jaiseaugustine
10 Replies

4. Shell Programming and Scripting

loop with a counter on a constant in bash

Hello Everyone, I'm in need of assistance on creating a script with a counter on a certain string. Basically this script opens a log file and displays certain log data. There are two key words in the log. START and FINISH. In between the START and FINISH is a variable ACTNUMBER. It will... (1 Reply)
Discussion started by: rxc23816
1 Replies

5. Shell Programming and Scripting

How to implement the counter in loop?

Hi, I am working on a script where I need to add one functionality i.e. to could the number of tar files at particular location...but the script is working in below way. 1) create sandbox 2) Drop old member function 3) addmember function 4) Apply checkpoint lable 5) Resync operation(This... (1 Reply)
Discussion started by: anuragpgtgerman
1 Replies

6. Homework & Coursework Questions

Min/Max/counter/while loop from file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: The program is supposed to read in text from a given file ( different samples provided in the homework but not... (1 Reply)
Discussion started by: c++newb
1 Replies

7. Shell Programming and Scripting

Loop usage with counter

Hi friends, I just want to try some thing with shell using loop and counter I have 30 Directory, in each directory number of files say 5, 10, 20 etc... directory_1 directory_2 directory_n what I want to do is read files from directory_1 say 5 files if my counter is like this m=2000 ... (6 Replies)
Discussion started by: Akshay Hegde
6 Replies

8. Shell Programming and Scripting

Avoid multiple emails being sent - Counter, Loop?

Hello, I have currently coded a bash script below in which it does the following: # Archives compressed file from another location. Basically it moves *.gz files to another location. The script also sends an email whenever a new compressed file is placed. This is the issue that i... (5 Replies)
Discussion started by: Wizard_1979
5 Replies

9. Shell Programming and Scripting

Loop counter resets by itself

Hi! Can anyone explain this? The counter CDR_count should go on forever, but it suddenly resets at every step of the FOR loop (I know this because $_file has exactly 378 records). However, the counter reset is OUTSIDE the FOR loop. What's going on?? #!/bin/bash if || ; then echo ... (8 Replies)
Discussion started by: Flavius
8 Replies

10. Shell Programming and Scripting

While loop with limit counter

#!/usr/bin/ksh c=0 while ]; do echo /tmp/unex NOT found, iter : $c; ((c = $c + 1)); sleep 2; done so, the above counter doesn't work, already tried both -lt & -gt, and changed || to && so what am I missing? Thanks in advance (5 Replies)
Discussion started by: unexistance
5 Replies
counter(n)						      Counters and Histograms							counter(n)

NAME
counter - Procedures for counters and histograms SYNOPSIS
package require Tcl 8 package require counter ?2.0? ::counter::init tag args ::counter::count tag ?delta? ?instance? ::counter::start tag instance ::counter::stop tag instance ::counter::get tag args ::counter::exists tag ::counter::names ::counter::histHtmlDisplay tag args DESCRIPTION
The counter package provides a counter facility and can compute statistics and histograms over the collected data. ::counter::init tag args This defines a counter with the name tag. The args determines the characteristics of the counter. The args are -group name Keep a grouped counter where the name of the histogram bucket is passed into ::counter::count. -hist bucketsize Accumulate the counter into histogram buckets of size bucketsize. For example, if the samples are millisecond time values and bucketsize is 10, then each histogram bucket represents time values of 0 to 10 msec, 10 to 20 msec, 20 to 30 msec, and so on. -hist2x bucketsize Accumulate the statistic into histogram buckets. The size of the first bucket is bucketsize, each other bucket holds values 2 times the size of the previous bucket. For example, if bucketsize is 10, then each histogram bucket represents time values of 0 to 10 msec, 10 to 20 msec, 20 to 40 msec, 40 to 80 msec, and so on. -hist10x bucketsize Accumulate the statistic into histogram buckets. The size of the first bucket is bucketsize, each other bucket holds values 10 times the size of the previous bucket. For example, if bucketsize is 10, then each histogram bucket represents time val- ues of 0 to 10 msec, 10 to 100 msec, 100 to 1000 msec, and so on. -lastn N Save the last N values of the counter to maintain a "running average" over the last N values. -timehist secsPerMinute Keep a time-based histogram. The counter is summed into a histogram bucket based on the current time. There are 60 per- minute buckets that have a size determined by secsPerMinute, which is normally 60, but for testing purposes can be less. Every "hour" (i.e., 60 "minutes") the contents of the per-minute buckets are summed into the next hourly bucket. Every 24 "hours" the contents of the per-hour buckets are summed into the next daily bucket. The counter package keeps all time-based histograms in sync, so the first secsPerMinute value seen by the package is used for all subsequent time-based histograms. ::counter::count tag ?delta? ?instance? Increment the counter identified by tag. The default increment is 1, although you can increment by any value, integer or real, by specifying delta. You must declare each counter with ::counter::init to define the characteristics of counter before you start to use it. If the counter type is -group, then the counter identified by instance is incremented. ::counter::start tag instance Record the starting time of an interval. The tag is the name of the counter defined as a -hist value-based histogram. The instance is used to distinguish this interval from any other intervals that might be overlapping this one. ::counter::stop tag instance Record the ending time of an interval. The delta time since the corresponding ::counter::start call for instance is recorded in the histogram identified by tag. ::counter::get tag args Return statistics about a counter identified by tag. The args determine what value to return: -total Return the total value of the counter. This is the default if args is not specified. -totalVar Return the name of the total variable. Useful for specifying with -textvariable in a Tk widget. -N Return the number of samples accumulated into the counter. -avg Return the average of samples accumulated into the counter. -avgn Return the average over the last N samples taken. The N value is set in the ::counter::init call. -hist bucket If bucket is specified, then the value in that bucket of the histogram is returned. Otherwise the complete histogram is returned in array get format sorted by bucket. -histVar Return the name of the histogram array variable. -histHour Return the complete hourly histogram in array get format sorted by bucket. -histHourVar Return the name of the hourly histogram array variable. -histDay Return the complete daily histogram in array get format sorted by bucket. -histDayVar Return the name of the daily histogram array variable. -resetDate Return the clock seconds value recorded when the counter was last reset. -all Return an array get of the array used to store the counter. This includes the total, the number of samples (N), and any type-specific information. This does not include the histogram array. ::counter::exists tag Returns 1 if the counter is defined. ::counter::names Returns a list of all counters defined. ::counter::histHtmlDisplay tag args Generate HTML to display a histogram for a counter. The args control the format of the display. They are: -title string Label to display above bar chart -unit unit Specify minutes, hours, or days for the time-base histograms. For value-based histograms, the unit is used in the title. -images url URL of /images directory. -gif filename Image for normal histogram bars. The filename is relative to the -images directory. -ongif filename Image for the active histogram bar. The filename is relative to the -images directory. -max N Maximum number of value-based buckets to display. -height N Pixel height of the highest bar. -width N Pixel width of each bar. -skip N Buckets to skip when labeling value-based histograms. -format string Format used to display labels of buckets. -text boolean If 1, a text version of the histogram is dumped, otherwise a graphical one is generated. counter 2.0 counter(n)
All times are GMT -4. The time now is 12:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy