Sponsored Content
Top Forums Shell Programming and Scripting trying to learn for loops, and arrays at the same time Post 302195349 by rubin on Wednesday 14th of May 2008 09:29:23 PM
Old 05-14-2008
awk

If I correctly understand your requirement:

HDBOXREPORT

Code:
                                                  
1033 1
1079 4
1453 5
2205 6
1933 7
461 8
646 9
1655 12
975 13
1289 14

QSPK-list

Code:
+-----------------------------------------+ +-------------------------+
| QPSK Name Broadcast_Addr ID | | ID QPSK Name |
+-------------------- --------------- --- + + --- --------------------+
| BERGENQPSK1 10.180.127.255 90 | | 1 SMANHUBBQPSKE02 |
| BERGENQPSK1B 10.182.127.255 238 | | 2 SMANHUBBQPSKE03 |
| BERGENQPSK2 10.180.191.255 109 | | 3 SMANHUBBQPSKE04 |
| BERGENQPSK2B 10.182.191.255 239 | | 4 SMANHUBDQPSKE01 |
| BERGENQPSK3 10.180.255.255 158 | | 5 SMANHUBDQPSKE02 |
| BERGENQPSK3B 10.182.255.255 240 | | 6 SMANHUBCQPSKE03 |
| BERGENQPSK4 10.181.127.255 93 | | 7 SMANHUBCQPSKE04


Code:
awk 'NR==FNR{a[$2]=$2;next}
 $7 in a {print $7, $8}' HDBOXREPORT QSPK-list


Output:

Code:
1 SMANHUBBQPSKE02
4 SMANHUBDQPSKE01
5 SMANHUBDQPSKE02
6 SMANHUBCQPSKE03
7 SMANHUBCQPSKE04

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Where to Learn About HP-UX

can someone give me the link to any site that deals on HP-UX system administration?? Please do not refer me to buy or borrow any books, i just need a free site to learn some quick info from (1 Reply)
Discussion started by: TRUEST
1 Replies

2. UNIX for Dummies Questions & Answers

should i take the time to learn?

im new to UNIX but i know some commands and i bought a book about it but what i was wondering is.. should i learn about it i don't have a job where i use it im still in high school so there isn't any classes i can take where i need to learn it i just wanted to see how it works. From what i've heard... (1 Reply)
Discussion started by: hiei
1 Replies

3. Shell Programming and Scripting

korn shell "loops & arrays"

Hi, I am trying to write a script which will loop until a certain action has been performed. I have two files i would like to compares. For example: file1 has a list of user ids (about 900) from the company's e-mail server. file2 has a list of user ids (about 50 or so) from... (7 Replies)
Discussion started by: muzica
7 Replies

4. Shell Programming and Scripting

arrays and while loops in bash

hi guys, i have an array called ARRAY which has elements in it... i am trying to assign elements of ARRAY to master_array.. i get a =: command not found error.. i=0 while do ${master_array}=${ARRAY} ((i++)) done is there something i am missing? (4 Replies)
Discussion started by: npatwardhan
4 Replies

5. Web Development

PHP arrays in arrays

PHP question... I have an SQL query that's pulled back user IDs as a set of columns. Rather than IDs, I want to use their names. So I have an array of columns $col with values 1,7,3,12 etc and I've got an array $person with values "Fred", "Bert", "Tom" etc So what I want to do is display the... (3 Replies)
Discussion started by: JerryHone
3 Replies

6. Shell Programming and Scripting

First time with loops!

My script that I have gotten much help with on here is almost complete.. I need to add a loop, to try a script 4 times, after the 4th time, just stop.. do auth=$(ps -ef | grep uth | awk '{ print $2}') if then echo "Process is running" ps=$(ps -ef | grep ps | awk... (3 Replies)
Discussion started by: jeffs42885
3 Replies

7. Programming

question about int arrays and file pointer arrays

if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
Discussion started by: omega666
1 Replies

8. UNIX for Dummies Questions & Answers

Dealing with Double Loops, Arrays and GREP

Can someone please help me to learn how to deal with loops, arrays and grep? I have two arrays (lets say I and j) each in a separate file And have file with lines of data I need to extract, such as Ruby Smith: some text here Ruby Smith: some other text here Ruby Brown: some text here Ruby... (10 Replies)
Discussion started by: A-V
10 Replies

9. Shell Programming and Scripting

For i in loops on 2 arrays

Hey , i have this script and i have these loops so it can find a match between 2 arrays : ARRAY_1=(one two three) ARRAY_2=(A B C) VAR='B' for NUMBERS in "${ARRAY_1}" do for LETTERS in "${ARRAY_2}" do if ];then VAR='LETTERS' ... (2 Replies)
Discussion started by: batchenr
2 Replies
sa2(8)							    BSD System Manager's Manual 						    sa2(8)

NAME
sa2 -- Generate a system activity daily report file. SYNOPSIS
/usr/lib/sa/sa2 [-dgpu] [-n mode] [-e time] [-f filename] [-i seconds] [-s time] DESCRIPTION
The sa2 command is a shell script used to invoke the system activity reporter sar for purposes of generating the standard default daily report file. The report file generated is, /var/log/sa/sardd where the dd represents the current day of the month. The sa2 options are the same as those documented in sar(1). When sa2 runs, it will also remove data and report files, found in /var/log/sa, that are more than one week old. The sa2 command is intended to be started by cron. EXAMPLE CRON ENTRY
# Starting at 8am collect system activity records # every 20 minutes for 12 hours # 20 minutes = 1200 seconds # 12 hours with 3 samples each hour = 36 loops 0 8 * * 1-5 /usr/lib/sa/sa1 1200 36 # After the 12 hour period, # collect a system activity report 30 20 * * 1-5 /usr/lib/sa/sa2 -A FILES
/var/log/sa/sardd Default daily report file. /var/log/sa/sadd Default daily data file. dd are digits that represent the day of the month. SEE ALSO
crontab(1), fs_usage(1), netstat(1), sar(1), sc_usage(1), top(1), vm_stat(1), crontab(5), iostat(8), sa1(8), sadc(8) Mac OS X Jul 25 2003 Mac OS X
All times are GMT -4. The time now is 08:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy