Sponsored Content
Full Discussion: grep within while read loop
Top Forums Shell Programming and Scripting grep within while read loop Post 302364964 by Scrutinizer on Saturday 24th of October 2009 06:12:18 PM
Old 10-24-2009
You do not need cut BTW:
Code:
#!/bin/ksh
while IFS=: read x addr x; do
  grep "${addr%% }" mlist;
done<klist

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

read inside a while loop

Hi all, In a while loop, like below... while read line do read choice case $choice in 1) echo "xxx" esac done < file why I can't run the read choice???? (3 Replies)
Discussion started by: dta4316
3 Replies

2. Shell Programming and Scripting

Need Help : while read loop

hi all, Can you please help me with this issue ? while ####infinite loop do cat file1 |while read var1 var2 do func1 $var1 $var2 done cat file2 | while read var11 var22 do func2 $var11 $var22 done done func1 is called till all the values are read... (2 Replies)
Discussion started by: Navatha
2 Replies

3. Shell Programming and Scripting

read line in a for loop

Hi All, How can we use read line using the index value of a FOR loop? eg: pt_mstr,pt_status,8 pt_mstr,pt_buyer,8 pt_mstr,pt_sfty_stk,8 pt_mstr,pt_ord_pol,3 pt_mstr,pt_capacity,8 pt_mstr,pt_plan_ord,3 pt_mstr,pt_ord_mult,8 From this file i want to read the line2, 3 and 4 only using a FOR... (3 Replies)
Discussion started by: balajim
3 Replies

4. Shell Programming and Scripting

Need help with for loop with while read

Hello, The code below pulls printer information from a three-column file (set by the ${MULTIFILE} variable at the end), that has the printer queue name, IP, and type of printer. It is supposed to use this info to add the printers in the list to one, or more servers . The input file... (3 Replies)
Discussion started by: LinuxRacr
3 Replies

5. Shell Programming and Scripting

While read line loop

Hi I'm writing a bash script which will read an input file and look for occurrences of the current user ($USER) executing the script. When i find the occurrence of the username I take that line and append it to a file with a line number and bracket display next to line. The input file has been... (12 Replies)
Discussion started by: BundBash
12 Replies

6. Shell Programming and Scripting

until loop and read

Hi guys what I wanna do is to create a script where can I input several times a file - assume with read function that will be inserted into a temp. file for further processing. When I press q I want that the loop will stop and continue in my script I typed this but the options q is not working... (6 Replies)
Discussion started by: kl1ngac1k
6 Replies

7. UNIX for Dummies Questions & Answers

Read statement within while read loop

hi, this is my script #!/bin/ksh cat temp_file.dat | while read line do read test if ]; then break else echo "ERROR" fi done when i execute this code , the script does wait for the user input . it directly prints "ERROR" and terminates after the no. of times as there... (3 Replies)
Discussion started by: siva1612
3 Replies

8. Shell Programming and Scripting

Help with while read loop

Hey all, Tried searching the forums but my search-fu may not be strong today; please feel free to redirect me if I have simply missed a post that would be helpful! Trying to create a while loop that reads a list of configuration files, checks for a line that starts with "SOME_CMD" and ends... (4 Replies)
Discussion started by: jdwyer
4 Replies

9. UNIX for Dummies Questions & Answers

Piping grep into awk, read the next line using grep

Hi, I have a number of files containing the information below. """"" Fundallinfo 6.3950 14.9715 14.0482 """"" I would like to grep for Fundallinfo and use it to read the next line? I ideally would like to read the three numbers that follow in the next line and... (2 Replies)
Discussion started by: Paul Moghadam
2 Replies

10. Shell Programming and Scripting

Failure: if grep "$Var" "$line" inside while read line loop

Hi everybody, I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o My code: #!/bin/sh set -e set -u export IFS= optl="Optl" LOCSTORCLI="/opt/lsi/storcli/storcli" ($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
Discussion started by: Subsonic66
5 Replies
MTEST(8)						    BSD System Manager's Manual 						  MTEST(8)

NAME
mtest -- test multicast socket operations SYNOPSIS
mtest DESCRIPTION
The mtest utility is a small program for testing multicast socket operations. It accepts the following commands, interactively, or as part of a scripted input file (useful for automated testing): a ifname mac-addr Join the link-layer group address mac-addr on interface ifname. The group address should be in IEEE 802 MAC format, delimited by colon (':') characters. d ifname mac-addr Leave the link-layer group address mac-addr on interface ifname. m ifname 1/0 Set or reset ALLMULTI mode on interface ifname. This option is deprecated and is now a no-op. p ifname 1/0 Set or reset promiscuous mode on interface ifname. j mcast-addr ifname [source-addr] Join the multicast address mcast-addr on the interface with name ifname. If an optional source source-addr is specified, a source-specific join will be performed; if mtest is already joined to the multicast address, the source will be added to its filter list. l mcast-addr ifname [source-addr] Leave the multicast address mcast-addr on the interface with address ifname. If a source source-addr is specified, only that source will be left. i mcast-addr ifname n source-addr ... Set the socket with membership of mcast-addr on interface ifname to include filter mode, and add n sources beginning with source-addr to the inclusion filter list. e mcast-addr ifname n source-addr ... Set the socket with membership of mcast-addr on interface ifname to exclude filter mode, and add n sources beginning with source-addr to the exclusion filter list. t mcast-addr ifname source-addr Set the socket with membership of mcast-addr on interface ifname to block traffic from source source-addr. b mcast-addr ifname source-addr Set the socket with membership of mcast-addr on interface ifname to allow traffic from source source-addr. g mcast-addr ifname n Print n source filter entries for mcast-addr on interface ifname. f filename Read commands from the file filename. s n Sleep for n seconds. ? List legal commands. q Quit the program. IMPLEMENTATION NOTES
For each command implemented by mtest, the address family of each argument must be identical; it is not possible to mix IPv4 multicast mem- berships with IPv6, for example. To support IPv6, all commands have now changed to accept an interface name rather than an interface address. For IPv4, the program will per- form a lookup of the primary IP address based on the interface name. This may fail if no primary IP address is assigned. SEE ALSO
D. Thaler, B. Fenner, and B. Quinn, Socket Interface Extensions for Multicast Filters, RFC 3678. AUTHORS
Bruce Simpson Steve Deering Wilbert De Graaf BSD
April 29, 2009 BSD
All times are GMT -4. The time now is 02:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy