Sponsored Content
Full Discussion: script to iterate
Top Forums Shell Programming and Scripting script to iterate Post 302561537 by Tytalus on Tuesday 4th of October 2011 11:29:14 AM
Old 10-04-2011
something along the lines of:

Code:
(rewriting your equation to isolate an iteration:

x=y/ln(3.455613x)
)

#  y=1;x=1;for i in {1..100}; do x=$(calc "$y/(log(3.455613*$x))"); echo $x;done
0.806452
0.975715
.
<snip>
.
0.890054
0.890054

where I have calc as a function:

#  typeset -f calc
calc ()
{
    nawk 'BEGIN { OFMT="%f"; print '"$*"'; exit}'
}

In this case, then:

#  calc "log(0.890054)"+1.24
1.123527

#  calc 1/0.890054
1.123527

You may prefer to define an epsilon value and check the diff between successive iterations to define your accuracy.

HTH

This User Gave Thanks to Tytalus For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

iterate sed over files

Greetings. I'm having a time of it with this file. I'm trying to do a script that will take two command line inputs, string1 and string2 and use sed to change the text over files in the current directory. This is what I have so far. It appears to work a little, it does create the... (3 Replies)
Discussion started by: rdanda
3 Replies

2. Shell Programming and Scripting

iterate over array

I can not for the life of me figure out how to iterate over this array { 'name1' => { 'a' => . 'b' => }, 'name2' => { 'a' => . 'b' => } } I want a for loop to iterate through the first element (name1 and name2 in my example) but I can't figure it out. Help... (2 Replies)
Discussion started by: IMTheNachoMan
2 Replies

3. UNIX for Dummies Questions & Answers

Iterate a min/max awk script over time-series temperature data

I'm trying to iterate a UNIX awk script that returns min/max temperature data for each day from a monthly weather data file (01_weath.dat). The temperature data is held in $5. The temps are reported each minute so each day contains 1440 temperature enteries. The below code has gotten me as far as... (5 Replies)
Discussion started by: jgourley
5 Replies

4. Shell Programming and Scripting

Shell - How to iterate through all the files in a directory?

Hi, I have a directory call Test, which contains files "a", b", "c", etc. I want to go through all of the files inside Test and remove any empty file. How would I do that with shell csh? So far I got... #!/bin/csh if (($#argv == 0) || ($#argv > 1)) then echo "no argument or too... (2 Replies)
Discussion started by: teiji
2 Replies

5. Shell Programming and Scripting

Need script to count specific word and iterate over number of files.

Hi Experts, I want to know the count of specific word in a file. I have almost 600+ files. So I want to loop thru each file and get the count of the specific word. Please help me on achieving this... Many thanks (2 Replies)
Discussion started by: elamurugu
2 Replies

6. UNIX for Dummies Questions & Answers

Script to iterate all command line arguments

Hi guys, I am having trouble with this script. What i want it to do is to iterate all command line arguments in reverse order. The code below does this fine but i need the output to print the words on separate lines instead of one line: #!/bin/bash #Takes in the arguments and displays them... (7 Replies)
Discussion started by: pipeline2012
7 Replies

7. Shell Programming and Scripting

Do loop doesn't iterate

I'm trying to send the file list as parameter to another job and execute it. But the loop doesn't work, the inner job is running only once and not twice as expected for filelist in $(ls -rt *.txt | tail -2) do echo $filelist export filelist cmd="$Program -config $configfile -autoexec... (11 Replies)
Discussion started by: asandy1234
11 Replies

8. Shell Programming and Scripting

Iterate column with perl

I can not figure out how to iterate a perl command that inputs a value into columns and then combines them. I need to put a numerical value in column one and the word "Null" in all others, and then join at the end. I think the below is close, but I am not sure about the lines in bold. I... (7 Replies)
Discussion started by: cmccabe
7 Replies

9. UNIX for Beginners Questions & Answers

Script to iterate over several options

Have two 3 files which has list of servers,users and location and base url which is common on every server A = server1 server2 server3 B = user1 user2 user3 C = dom1 dom2 dom3 baseurl=/opt/SP/ and what i have to achieve is below via ssh from REMOTE SERVER for it's first iteration it... (7 Replies)
Discussion started by: abhaydas
7 Replies

10. Shell Programming and Scripting

Iterate over `dirs` in a bash script

I would like to iterate over `dirs`in a script, but the script will never show more than one (current) folder #! /bin/bash for i in `dirs` do echo ${i} done echo ++++++++++++++++++ for i in $( dirs -p ) do echo ${i} done echo ------------------ dirscontent=`dirs` echo... (5 Replies)
Discussion started by: alexanderb
5 Replies
tntnet(8)							Tntnet users guide							 tntnet(8)

NAME
tntnet - web application server for c++ SYNOPSIS
tntnet [-c file] [--logall] tntnet -C [-q query-string] [componentId ...] DESCRIPTION
This manual page documents briefly the tntnet command. tntnet is a web server that can generate dynamic content via precompiled C++ modules. OPTIONS
A summary of options is included below. -c file Use file as the configuration file. If the -c is omitted, the first nonoption argument is used as the config file. --logall Initialize logging earlier. Normally logging is initialized after starting the listeners and changing user so that logfiles are cre- ated with the right owner. For debugging reasons this option forces to do that earlier. -C Call components and print the result to stdout instead of starting tntnet as a webserver -q query-string In -C mode pass this query string to the component. The option may be repeated multiple times to pass name-value-pairs easily. EXAMPLE
tntnet -C -q arg1=35 -q arg2=7 -q op=/ calc@calc calls the component calc@calc with query parameters and prints the result to stdout. FILES
/etc/tntnet/tntnet.conf The default configuration file. ENVIRONMENT
TNTNET_CONF This is checked for the configuration file name if it is not specified on the command line. AUTHOR
tntnet was written by Tommi Makitalo <tommi@tntnet.org>. This manual page was written by Kari Pahula <kaol@debian.org>, for the Debian project (but may be used by others). SEE ALSO
tntnet-config(1), ecpp(7), ecppc(1), ecppl(1), ecppll(1), tntnet.conf(7), tntnet.properties(7). More documentation can be found in /usr/share/doc/tntnet-doc/. Tntnet July 23, 2006 tntnet(8)
All times are GMT -4. The time now is 01:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy