Computing.Net > Forums > Unix > Looping - shell scripting

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Looping - shell scripting

Reply to Message Icon

Name: camin
Date: May 7, 2004 at 07:46:30 Pacific
OS: SunOS 5.8 Generic_108528-
CPU/Ram: unknown
Comment:

Hi All,

I need to write a script to find from dept1 to 45 = no. How do I go about doing this?
Any help will be greatly appreciated.
Thanks.
camin




Sponsored Link
Ads by Google

Response Number 1
Name: thepubba
Date: May 7, 2004 at 11:10:00 Pacific
Reply:

Perhaps you want something like this?

#!/bin/ksh

Counter=1

while [[ $Counter -le 45 ]]
do
find / -group dept$Counter -print
(( Counter += 1 ))
done


0

Response Number 2
Name: camin
Date: May 7, 2004 at 12:15:21 Pacific
Reply:

Thanks a bunch Jerry I will try that right now..
camin


0

Response Number 3
Name: camin
Date: May 7, 2004 at 14:17:07 Pacific
Reply:

Hi Jerry,

I am having a problem, your solution is OK, but maybe I did not explain correctly what I want to do:
There are 27 fields in the db, and for the 27 fields the label is lets say dept1 to 27 and the value for each could be AA BB CC, but I need to go thru all 27 to get CC value and pipe the results into a file....
can you help?
thanks
camin


0

Response Number 4
Name: WilliamRobertson
Date: May 9, 2004 at 15:20:53 Pacific
Reply:

I don't understand what you mean by "There are 27 fields in the db". What db? What is a field?


0

Response Number 5
Name: camin
Date: May 10, 2004 at 06:52:11 Pacific
Reply:

Hi William,

What I mean is that db is the database, this is like a database for bug tracking program, all defects are entered into here, and so on. So on one form there are these 27 fields that could have the value of 3 possibilities, AA, BB, or CC.
Is this clear now...the counter could probably work.....I will try that again....


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Looping - shell scripting

loops in shell scripts!!! www.computing.net/answers/unix/loops-in-shell-scripts/5140.html

Shell script www.computing.net/answers/unix/shell-script-/3596.html

help with shell script www.computing.net/answers/unix/help-with-shell-script/7840.html