loop through configs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting loop through configs
# 1  
Old 04-07-2011
loop through configs

hi All, is there a way in linux to loop thru all variables sourced?
i have a set configs like
A=100
b=200
c=400
i can add the above lines to a file and source - so that $A will be 100 .. like wise

now when i do a cut -c 1-2 file.txt |sort | uniq -c on a file it returns me
A 100
B 50
c 450
d 180

now i want to run thru the config [looking for something like for i in $() - not sure it works with variables]and find the file has any values [A/B/C] has passed the config value
say in this case C has passed 400

please help

---------- Post updated at 08:22 AM ---------- Previous update was at 07:58 AM ----------

think this will work
set -o posix ; set
# 2  
Old 04-07-2011
not entirely sure I understand your requirements, but is this what you're after ??

Code:
 cut -c 1-2 file.txt |sort | uniq -c| awk '$2>400'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Chef client on VIOs? How do you manage your VIO configs?

I know the VIOs are generally to be treated as an appliance and one should never drop down to oem_setup_env. In reality however, oem is a very useful tool to get the job done. So that leads me into the question of using the Chef client on a VIO. Currently a big push to manage all our *nix... (4 Replies)
Discussion started by: RecoveryOne
4 Replies

2. Shell Programming and Scripting

awk loop using array:wish to store array values from loop for use outside loop

Here's my code: awk -F '' 'NR==FNR { if (/time/ && $5>10) A=$2" "$3":"$4":"($5-01) else if (/time/ && $5<01) A=$2" "$3":"$4-01":"(59-$5) else if (/time/ && $5<=10) A=$2" "$3":"$4":0"($5-01) else if (/close/) { B=0 n1=n2; ... (2 Replies)
Discussion started by: klane
2 Replies

3. Shell Programming and Scripting

Expect script to show cisco configs

I know there are better ways to do this. I prefer snmp. I do not have the proper perl modules loaded on the platorm. Snmp isnt loaded on the platform. Telnet is not an option. I need to write an expect script to pull cisco equipment configs. The following code is executed once I gain... (0 Replies)
Discussion started by: popeye
0 Replies

4. Linux

Packages that monitor OS configs and service/ports?

I have several Redhat servers and workstations that I need to be able to monitor for any changes and be notified of any changes to the OS. The features I need to specifically monitor are: ports - opening of new ports that are not already in a whitelist services - any starting or attempts to start... (1 Reply)
Discussion started by: JCDinPGH
1 Replies

5. Shell Programming and Scripting

Array Variable being Assigned Values in Loop, But Gone when Loop Completes???

Hello All, Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....? I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping through a string containing some of these "Illegal Characters". Now... (5 Replies)
Discussion started by: mrm5102
5 Replies

6. Red Hat

Sudo command configs

I am wondering how to use SUDO command to allow only my account to run mount command as root. I have root privilege.:confused: (4 Replies)
Discussion started by: almirzaee
4 Replies

7. UNIX for Dummies Questions & Answers

VI - in need of configs/scripts

Hi, I'm somewhat new to unix OS and I'm at course for programmers in my country. and in the course we learn unix and how to script in unix. of course we just started and we learned only the very basic, but I'm a really computer freak and I looking for a way to make the course easier on all of... (8 Replies)
Discussion started by: Bonzay0
8 Replies

8. Infrastructure Monitoring

Script to sort Cisco configs

Hi everyone :), I need sort Cisco configs to report but i cannot do the script to made this: #### INPUT ##### config-register 0x2102 version 12.2 ! hostname Router ! interface Ethernet0 description Red LAN ip address 192.168.1.1 255.255.255.0 no cdp enable ! interface Serial0... (6 Replies)
Discussion started by: azrael75
6 Replies

9. 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

10. UNIX for Dummies Questions & Answers

mail configs and linux suse 9

Hello, I am needing to find what smtp server we are using on our linux box that run suse 9 when ever we mail out from the box using the mail command.... I have searched the board and see references to sendmail.cf but can't find this file on our box... I see alot of mail configs in /etc/postfix... (2 Replies)
Discussion started by: benefactr
2 Replies
Login or Register to Ask a Question