Sponsored Content
Full Discussion: Iterative operation
Top Forums Shell Programming and Scripting Iterative operation Post 302229696 by era on Wednesday 27th of August 2008 03:54:22 PM
Old 08-27-2008
What can I say other than works for me.

Code:
vnix$ cat >/tmp/ip
If I were a rich man I'd pwn 81.17.242.186 but I'm not so I don't.
^D
vnix$ grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' /tmp/ip |
> while read ip; do OLDIFS=$IFS; IFS=.; set -- $ip; IFS=$OLDIFS;
>   echo IP=$ip, hostname=`dig +short ptr $4.$3.$2.$1.in-addr.arpa.`; done
IP=81.17.242.186, hostname=www.unix.com.

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

split operation

Hello, How to undo split operation ? (1 Reply)
Discussion started by: scotty_123
1 Replies

2. Shell Programming and Scripting

Help with arithmetic operation

I am using egrep to extract numbers from a file and storing them as variables in a script. But I am not able to do any arithmetic operations on the variables using "expr" because it stores them as char and not integers. Here is my code and the error I get. Any help will be appreciated. #!/bin/sh... (3 Replies)
Discussion started by: emjayshaikh
3 Replies

3. Shell Programming and Scripting

Array operation

Hi, I would like ask for you help for coding array operation. array= ( a b c d e f ) I would like to remove entry "d" from my array and import the remaining entries back to the array. Thanks. (3 Replies)
Discussion started by: phamp008
3 Replies

4. UNIX for Dummies Questions & Answers

cat operation

Hi, Can anyone explain me what is the functionality of this code cat << EOF > $TSTFILE /$1/ { print "SENT" } EOF Suggestions welcome Thanks in advance (0 Replies)
Discussion started by: trichyselva
0 Replies

5. Shell Programming and Scripting

Need help with some iterative file processing

Gurus - Please help with this urgent situation. I have the following problem to solve using a shell script: 1. There are about 13 files named CONTAINER_1.lst, CONTAINER_2.lst, CONTAINER_3.lst .....CONTAINER_13.lst 2. Each of these files contain about 8 lines (in most cases) containing... (1 Reply)
Discussion started by: inditopgun
1 Replies

6. UNIX for Dummies Questions & Answers

string operation

I am trying to ask for full name in a script, Then echo back to the user with the surname only, omitting the first name. Thanks (2 Replies)
Discussion started by: orjnet
2 Replies

7. Shell Programming and Scripting

Iterative statement to cut values from a line

Hi I am new to shell scripting and trying to get values from a text file, I have a text file with values seperated with "|". like aga|120220090525|120220090525|120220090525|120220090530 bab|120220090530|120220090530|120220090535|120220090535|120220090535... (4 Replies)
Discussion started by: mannepalli
4 Replies

8. Shell Programming and Scripting

Column operation : cosne and sine operation

I have a txt file with several columns and i want to peform an operation on two columns and output it to a new txt file . file.txt 900.00000 1 1 1 500.00000 500.00000 100000.000 4 4 1.45257346E-07 899.10834 ... (4 Replies)
Discussion started by: shashi792
4 Replies

9. Shell Programming and Scripting

iterative parsing

I have always struggled when parsing a file vertically vs. by line horizontally. Can't seem to get my head around the concept. Here again I need to convert vertical output to horizontal output. original output root@acuransx:bpplsched 2000-STAND3 -v -M acuransx -l <2>bpplsched: INITIATING:... (4 Replies)
Discussion started by: jouuu
4 Replies

10. Shell Programming and Scripting

If then else - Retry operation

I need to read a file line by line, then depending on the contents of each line, type in a code that will get written to an array. The problem I have is when I ask the user to confirm the input code, if it is wrong, how do i Return to ask again? Any thing I try increments the file to the next... (6 Replies)
Discussion started by: kcpoole
6 Replies
ASP(1)								    User Manual 							    ASP(1)

NAME
asp - find an host IP address by its name SYNOPSIS
asp [-uv] [-f | [-d dir] [-e ext]] [-a addresses] [-r repetitions] [-s send_delay] [-w wait_time] [-p port] hostname asp -V DESCRIPTION
Asp finds the IP address of an Internet connected host. In order to find it, the peer hostname (not the FQDN), and the range of its possi- ble IP addresses need to be specified. Those IP addresses could be simple IP addresses as 127.0.0.1 or "metaip" addresses as 127.0.0.1-20 or 127.0.0.*: the former is a simple way to avoid to type a lot of consecutive addresses, the latter is short for 127.0.0.1-254. In order to simplify the management of the associations between hostnames and addresses, asp searches in a specified directory a text file containing the possible IP addresses of the looked for host. The name of the text file has to be formed by the hostname followed by an optional extension of your choice. For example to find the author's dynamic IP address, obviously if I am on line, you can provide my metaip address on standard input with the command: echo "195.31.186.1-62 194.166.58.2-18" | asp -f atomic or you can put my metaip address in a file called atomic in your ~/.asp directory, like this: echo "195.31.186.1-62 194.166.58.2-18" > ~/.asp/atomic and then you can simply do: asp atomic OPTIONS
-u Update the file /etc/hosts with the IP address of hostname or delete the possible old entry if the address is not found. Obviously the file have to by writable by the user. -v Include more verbiage to make output readable by humans. Default consists only of dotted quad IP address, which is intended for output substitution in scripts. -f Force the reading of addresses from standard input instead that from the hostname's file. -d dir Set the directory containing the addresses file referred by hostname to dir. Default is ~/.asp. -e ext Set addresses files extension to ext. Default is no extension. -a addresses Set the number of queries to send before make a pause of send_delay seconds. Default is 12 queries. -r repetitions Set the number of times to try the same address. Default is 3 times. -s send_delay Delay the sending of the next group of addresses send_delay seconds. Default is 2 seconds. -w wait_time Wait the peer reply for wait_time seconds. Default is 5 seconds. -p port Specify an alternative port number. For default the port number is obtained searching the asp entry in /etc/services. -V Show version information. ENVIRONMENT
ASPCMD This variable could be used to store your preferred settings. An option set in this environment variable could be overridden or tog- gled from command line. BUGS
UDP is an unreliable protocol, therefore there is a chance you will not find the host even if it is on line. Anyway, if you are sure that the peer is on line and asp aware, you could adjust the various parameters until you get a reply. At last you will find the correct set- tings for your particular needs. This until the RDM communication style will be implemented under Linux. Obviously the hostname has to be unique among the possible IP addresses: asp will hook to the first correct reply. AUTHOR
Stenio Brunetta <stenio@brunettaeperin.it> Comments and suggestions are welcome. ACKNOWLEDGMENTS
Steven N. Hirsch <shirsch@ibm.net> for v1.3 bug fix and for the verbose option. Colin Phipps <cphipps@doomworld.com> for the tmpnam security issue. SEE ALSO
aspd(8). Linux February 1997 ASP(1)
All times are GMT -4. The time now is 03:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy