01-23-2012
display which line returns specific output
Hi,
I'm trying to figure out a way to find which line in my file.txt with IP addresses:
192.168.0.1
192.178.0.2
etc...
returns specific result when I execute command affecting all lines.
For example when I run:
for line in `cat file.txt`;
do
snmpget $line
done
it displays the results from all lines but I cant tell which line returns which result. Any help on this?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I cannot figure this one out. I would like to do the following. I have a line that has 7 words. It is possible that the line can have 20 words too. I always want to show the 9th word and beyond. The 9th word will always change so I do not have something to search for, so I think... (1 Reply)
Discussion started by: ctcuser
1 Replies
2. UNIX for Dummies Questions & Answers
#!/bin/bash
{ && ; } || {
echo "Must enter between 1 and 5 parameters"
exit 1
}
for P
do
echo $P >> /tmp/task3
done
echo "SORTED: $(sort -n -r /tmp/task3)"
rm -f /tmp/task3 (2 Replies)
Discussion started by: knc9233
2 Replies
3. Shell Programming and Scripting
Hi
I am a rookie and I would like to know how to make a script that prints as a output lines between two lines let say first variable is a :
Mon Aug 31 09:00:00 2009 CET
and the last line is
Tue Sep 08 09:00:00 2009 CET
also
lets say third line from
Mon Aug 31 09:00:00... (3 Replies)
Discussion started by: DinoFly
3 Replies
4. Shell Programming and Scripting
Dear All
I want to search string "1000" from input file and if it found i want remove line that contain 1000 and also remove 3 line above it and 2 line below it.
INPUT FILE:
BHAT-D 2
aaa
ID CODE GS UPDATE MODE LANG MCO MCL NUMPAGES
50 ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies
5. Shell Programming and Scripting
I need to get total number of hdisk not assigned to any VGs.
PDC # lspv |grep None |awk '{print $1}' |wc
131 131 1099
So, it shows 131 hdisks.
I need to look at the individual hdisk fget_config info like below:
PDC # fget_config -Av |grep hdisk230
hdisk230 dac1 229... (4 Replies)
Discussion started by: Daniel Gate
4 Replies
6. Shell Programming and Scripting
Hi ,
1)i want to display specific line number using tail command.
e.g. display 10 line from end.
Please help...
2)Want to display line 10 to 15 (from end)using tail command) (2 Replies)
Discussion started by: vivek1489
2 Replies
7. Shell Programming and Scripting
This is Input - starts with Storage Group Name and ends with Shareable and the loop continues all I need is Storage group name and Alu numbers in the below output format requested.
Storage Group Name: abcd
Storage Group UID: 00:00:000:00:0:0:0
HBA/SP Pairs:
HBA UID ... (6 Replies)
Discussion started by: maddysa
6 Replies
8. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
What single command line would you enter to get the following output?
8140 drwxr-xr-x 9 root bin 18 Jan 20... (6 Replies)
Discussion started by: dasboot
6 Replies
9. UNIX for Dummies Questions & Answers
This could be a really dummy question.
I have a log text file.
What unix command to extract line from specific string to another specific string.
Is it something similar to?:
more +/"string" file_name
Thanks (4 Replies)
Discussion started by: aku
4 Replies
10. Shell Programming and Scripting
I pass a number to my script. Passing "1" below.
./getfile.sh 1
echo "User entered: $1"
ls -ltr *.conf | sed -n '$p'
I wish to use ls -ltr i.e list files in ascending order of time the latest showing at the bottom of the output.
Number 1 should get me the last row of ls -ltr output i.e... (9 Replies)
Discussion started by: mohtashims
9 Replies
LEARN ABOUT LINUX
cidr_table
CIDR_TABLE(5) File Formats Manual CIDR_TABLE(5)
NAME
cidr_table - format of Postfix CIDR tables
SYNOPSIS
postmap -q "string" cidr:/etc/postfix/filename
postmap -q - cidr:/etc/postfix/filename <inputfile
DESCRIPTION
The Postfix mail system uses optional lookup tables. These tables are usually in dbm or db format. Alternatively, lookup tables can be
specified in CIDR (Classless Inter-Domain Routing) form. In this case, each input is compared against a list of patterns. When a match is
found, the corresponding result is returned and the search is terminated.
To find out what types of lookup tables your Postfix system supports use the "postconf -m" command.
To test lookup tables, use the "postmap -q" command as described in the SYNOPSIS above.
TABLE FORMAT
The general form of a Postfix CIDR table is:
network_address/network_mask result
When a search string matches the specified network block, use the corresponding result value. Specify 0.0.0.0/0 to match every IPv4
address, and ::/0 to match every IPv6 address.
An IPv4 network address is a sequence of four decimal octets separated by ".", and an IPv6 network address is a sequence of three to
eight hexadecimal octet pairs separated by ":".
Before comparisons are made, lookup keys and table entries are converted from string to binary. Therefore table entries will be
matched regardless of redundant zero characters.
Note: address information may be enclosed inside "[]" but this form is not required.
IPv6 support is available in Postfix 2.2 and later.
network_address result
When a search string matches the specified network address, use the corresponding result value.
blank lines and comments
Empty lines and whitespace-only lines are ignored, as are lines whose first non-whitespace character is a `#'.
multi-line text
A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line.
TABLE SEARCH ORDER
Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string.
EXAMPLE SMTPD ACCESS MAP
/etc/postfix/main.cf:
smtpd_client_restrictions = ... cidr:/etc/postfix/client.cidr ...
/etc/postfix/client.cidr:
# Rule order matters. Put more specific whitelist entries
# before more general blacklist entries.
192.168.1.1 OK
192.168.0.0/16 REJECT
SEE ALSO
postmap(1), Postfix lookup table manager
regexp_table(5), format of regular expression tables
pcre_table(5), format of PCRE tables
README FILES
Use "postconf readme_directory" or "postconf html_directory" to locate this information.
DATABASE_README, Postfix lookup table overview
HISTORY
CIDR table support was introduced with Postfix version 2.1.
AUTHOR(S)
The CIDR table lookup code was originally written by:
Jozsef Kadlecsik
KFKI Research Institute for Particle and Nuclear Physics
POB. 49
1525 Budapest, Hungary
Adopted and adapted by:
Wietse Venema
IBM T.J. Watson Research
P.O. Box 704
Yorktown Heights, NY 10598, USA
CIDR_TABLE(5)