|
|
|
|
|
|
| Author |
Message |
Jon LaBadie *nix forums beginner
Joined: 06 May 2006
Posts: 46
|
Posted: Wed May 10, 2006 1:52 pm Post subject:
Re: Script that gives instance count unique patterns in a sorted file
|
|
|
Chris F.A. Johnson wrote:
| Quote: | On 2006-05-04, Generic Usenet Account wrote:
I had a need for a script that operates on a text file, sorted by
lines, which gives the instance count for each unique pattern in the
file. Using my limited shell-scripting capabilities, I have come up
with something which works. However, I am keen to know how the real
"pros" will approach this problem.
uniq -c file
|
tr -cs '[:alpha:]' '[\n*]' < file | sort | uniq -c |
|
| Back to top |
|
 |
sbassle@ayecontractor.com *nix forums beginner
Joined: 27 Apr 2006
Posts: 4
|
Posted: Wed May 10, 2006 8:34 pm Post subject:
Re: bash and .profile
|
|
|
Creating a .bashrc seems to have done the trick. .bash_profile appears
to be ignored no matter what I do.
Thanks,
Steve |
|
| Back to top |
|
 |
Jordan Abel *nix forums Guru
Joined: 25 Oct 2005
Posts: 1366
|
Posted: Thu May 11, 2006 12:23 am Post subject:
Re: bash and .profile
|
|
|
On 2006-05-10, Steve <sbassle@ayecontractor.com> wrote:
| Quote: | I administer a number of AIX servers in a corporate environment. I've
recently converted to using bash as my personal login shell, but root
is and always has been defined with ksh as its default shell. I can
use "sudo su -" to get to root, and then execute bash, or I can "sudo
su - root -c bash", which does essentially the same thing in a single
command.
|
You shouldn't use a root prompt often enough to need to change this.
| Quote: | The problem: There are a few aliases and variables I'd like to
automatically customize for my bash environment when running as root,
but I don't know how to do it. Firing up bash in this way does not
seem to execute a .bash_profile. When I check my environment
variables, $SHELL is still set to ksh, so I can't use if/then/else
logic in .profile. Redefining the root account to use bash is not an
option, as I am not the only one with root access.
|
Wean yourself off of using the root prompt. Make the aliases you need
use sudo from your own account.
| Quote: | BTW, I typically login to a command line via PuTTY (SSH). No
X-Windows.
Any help would be greatly appreciated. Thanks. |
|
|
| Back to top |
|
 |
BN *nix forums beginner
Joined: 30 Aug 2005
Posts: 43
|
Posted: Fri May 12, 2006 1:58 am Post subject:
Re: Array Processing Please Help
|
|
|
Greetings Chris,
Here is the command:
set -A B $(echo "port $Port \n show post queue $Queue detail" |sp_ctrl
|egrep -i '^o\.| Redo log:| Log offset:|read rele
ased |hit count|Insert operations|Update operations|Delete
operations|at' |egrep -v 'Since|Operations')
I have multiple ports:
Port=" 1 2 3 4 5 6"
Each Port can have multiple Queue.
I run them in a double "for" loop to process all the queues for a given
port
here are 2 different outputs:
When state != Idle
o.xyzacd Running 19936822 08-May-06 09:26:59 161
112
Last operation posted:
Redo log: 5491 Log offset: 101466192
INSERT in "SCOTT"."DEPT" at 05/11/06 21:45:03
Post state : Commit transaction
Activation Id : 4
Number of messages read released : 374712781
Insert operations : 7920317
Update operations : 3042954
Delete operations : 2110956
Key cache hit count : 924366
SQL cache hit count : 75 %
When State=Idle
o.xyzacd Running 19942311 08-May-06 09:26:59 2
0
Last operation posted:
Redo log: 5491 Log offset: 116285104
INSERT in "SCOTT"."EMPLOYEE" at 05/11/06 21:47:52
Post state : Idle
Activation Id : 4
Number of messages read released : 374718326
Insert operations : 7922286
Update operations : 3043820
Delete operations : 2111593
Key cache hit count : 924669
SQL cache hit count : 75 %
If you want I can send you the full script.
Regards & Thanks |
|
| Back to top |
|
 |
Chris F.A. Johnson *nix forums Guru
Joined: 20 Feb 2005
Posts: 2268
|
Posted: Fri May 12, 2006 2:22 am Post subject:
Re: Array Processing Please Help
|
|
|
On 2006-05-12, BN wrote:
| Quote: | Greetings Chris,
Here is the command:
set -A B $(echo "port $Port \n show post queue $Queue detail" |sp_ctrl
|egrep -i '^o\.| Redo log:| Log offset:|read rele
ased |hit count|Insert operations|Update operations|Delete
operations|at' |egrep -v 'Since|Operations')
I have multiple ports:
Port=" 1 2 3 4 5 6"
Each Port can have multiple Queue.
I run them in a double "for" loop to process all the queues for a given
port
here are 2 different outputs:
|
What do you want to do with that output?
Please note that Google groups is a front end to Usenet newsgroups.
Please read <http://cfaj.freeshell.org/google> for information on
posting correctly from Google.
| Quote: | When state != Idle
o.xyzacd Running 19936822 08-May-06 09:26:59 161
112
Last operation posted:
Redo log: 5491 Log offset: 101466192
INSERT in "SCOTT"."DEPT" at 05/11/06 21:45:03
Post state : Commit transaction
Activation Id : 4
Number of messages read released : 374712781
Insert operations : 7920317
Update operations : 3042954
Delete operations : 2110956
Key cache hit count : 924366
SQL cache hit count : 75 %
When State=Idle
o.xyzacd Running 19942311 08-May-06 09:26:59 2
0
Last operation posted:
Redo log: 5491 Log offset: 116285104
INSERT in "SCOTT"."EMPLOYEE" at 05/11/06 21:47:52
Post state : Idle
Activation Id : 4
Number of messages read released : 374718326
Insert operations : 7922286
Update operations : 3043820
Delete operations : 2111593
Key cache hit count : 924669
SQL cache hit count : 75 %
If you want I can send you the full script.
|
That would be good, as would quoting context when you reply.
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence |
|
| Back to top |
|
 |
BN *nix forums beginner
Joined: 30 Aug 2005
Posts: 43
|
Posted: Fri May 12, 2006 3:27 am Post subject:
Re: Array Processing Please Help
|
|
|
Chris F.A. Johnson wrote:
| Quote: | On 2006-05-12, BN wrote:
Greetings Chris,
Here is the command:
set -A B $(echo "port $Port \n show post queue $Queue detail" |sp_ctrl
|egrep -i '^o\.| Redo log:| Log offset:|read rele
ased |hit count|Insert operations|Update operations|Delete
operations|at' |egrep -v 'Since|Operations')
I have multiple ports:
Port=" 1 2 3 4 5 6"
Each Port can have multiple Queue.
I run them in a double "for" loop to process all the queues for a given
port
here are 2 different outputs:
What do you want to do with that output?
Please note that Google groups is a front end to Usenet newsgroups.
Please read <http://cfaj.freeshell.org/google> for information on
posting correctly from Google.
When state != Idle
o.xyzacd Running 19936822 08-May-06 09:26:59 161
112
Last operation posted:
Redo log: 5491 Log offset: 101466192
INSERT in "SCOTT"."DEPT" at 05/11/06 21:45:03
Post state : Commit transaction
Activation Id : 4
Number of messages read released : 374712781
Insert operations : 7920317
Update operations : 3042954
Delete operations : 2110956
Key cache hit count : 924366
SQL cache hit count : 75 %
When State=Idle
o.xyzacd Running 19942311 08-May-06 09:26:59 2
0
Last operation posted:
Redo log: 5491 Log offset: 116285104
INSERT in "SCOTT"."EMPLOYEE" at 05/11/06 21:47:52
Post state : Idle
Activation Id : 4
Number of messages read released : 374718326
Insert operations : 7922286
Update operations : 3043820
Delete operations : 2111593
Key cache hit count : 924669
SQL cache hit count : 75 %
If you want I can send you the full script.
That would be good, as would quoting context when you reply.
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
|
Greetings,
I apologize for not following the Usenet netiquette
Thank you for the link.
I insert the output into an Oracle Database:
Full Script:
HOST_NAME=$(hostname)
PORT_NUMBER="1 2 3 4 5 6 7 8"
SP_CTRL="/apps/opt/splex/product/4.0/bin/sp_ctrl"
echo "\nREM Host=$HOST_NAME Date:`date`\n" >/tmp/bn1.sql
for Port in $PORT_NUMBER
do
# Get the queue name for all the given ports
QUEUE=$(echo "port $Port \n qstatus " |$SP_CTRL |egrep -i Name
|cut -f5 -d" ")
# for each port and each queue get the stats and store them in the
Database
for Queue in ${QUEUE}
do
echo "\nREM Port=$Port Queue=$Queue \n" >>bn1.sql
set -A B $(echo "port $Port \n show post queue $Queue detail" |$SP_CTRL
|egrep -i '^o\.| Redo log:| Log offset:|re
ad released |hit count|Insert operations|Update operations|Delete
operations|at' |egrep -v 'Since|Operations')
if [ "${B[25]}" = "Idle" ]
then
cat <<EOF >>/tmp/bn1.sql
insert into scott.my_stats
(HOST_NAME, INSTANCE_NAME, QUEUE_NAME, PORT_NUMBER,
STATUS, OPERATIONS_POSTED, POST_START_DATE,
TOTAL, BACKLOG, REDO_LOG,
LOG_OFFSET, LAST_OPERATION_POSTED_DATE,
LAST_OPERATION,
INSERTS, UPDATES, DELETES, SQL_CACHE_HIT_PERCENT, LAST_COLLECTED)
values
('${HOST_NAME}', '$ORACLE_SID', '$Queue', $Port,
'${B[1]}', ${B[2]}, to_date('${B[3]} ${B[4]}','DD-MON-YY
hh24:mi:ss'),
${B[5]}, ${B[6]}, ${B[12]},
${B[15]}, to_date('${B[20]} ${B[21]}','MM/DD/YY hh24:mi:ss'),
'${B[16]} ${B[17]} ${B[18]} ${B[19]} ${B[20]} ${B[21]}',
${B[40]}, ${B[44]}, ${B[48]}, ${B[60]}, sysdate);
commit;
EOF
else
cat <<EOF >>/tmp/bn1.sql
insert into scott.my_stats
(HOST_NAME, INSTANCE_NAME, QUEUE_NAME, PORT_NUMBER,
STATUS, OPERATIONS_POSTED, POST_START_DATE,
TOTAL, BACKLOG, REDO_LOG,
LOG_OFFSET, LAST_OPERATION_POSTED_DATE,
LAST_OPERATION,
INSERTS, UPDATES, DELETES, SQL_CACHE_HIT_PERCENT, LAST_COLLECTED)
values
('${HOST_NAME}', '$ORACLE_SID', '$Queue', $Port,
'${B[1]}', ${B[2]}, to_date('${B[3]} ${B[4]}','DD-MON-YY
hh24:mi:ss'),
${B[5]}, ${B[6]}, ${B[12]},
${B[15]}, to_date('${B[20]} ${B[21]}','MM/DD/YY hh24:mi:ss'),
'${B[16]} ${B[17]} ${B[18]} ${B[19]} ${B[20]} ${B[21]}',
${B[41]}, ${B[45]}, ${B[49]}, ${B[61]}, sysdate);
commit;
EOF
fi
done
done
# Insert the values into the DB
echo "/ as sysdba \n @/tmp/bn1.sql"|sqlplus -S
Regards & Thanks
BN |
|
| Back to top |
|
 |
Marty *nix forums Guru
Joined: 16 Mar 2005
Posts: 660
|
Posted: Fri May 12, 2006 7:40 am Post subject:
Re: Array Processing Please Help
|
|
|
2006-05-11, 17:20(-07), BN:
| Quote: | Greetings
HP-UX 11.11, K-Shell Script
I apologize, if you get this twice, I accidentally post the same to aix
group:
I am assigning output of a command to a K-Shell Array:
set - A B $(command)
|
There almost always exists a better way than using arrays in a
script. ksh88 arrays are a very limited and awkward feature.
So you want to insert an element in the middle of a ksh88 array
in position 26?
The easiest is probably something like:
set -f
set -A B -- $(command)
set -A B_new --
for i in "${B[@]}"; do
[ "${#B_new[@]}" -eq 25 ] &&
B_new[${#B_new[@]}]="<dummy>"
B_new[${#B_new[@]}]=$i
done
set -A B -- "${B_new[@]}"
# (untested)
With zsh, that would simply be:
B=(
$(command)
)
B[27,0]="<dummy>"
(zsh array indices start at 1, which makes it consistent with
$argv[<i>] ($<i>))
But please consider using text processing tools like awk to
process the output of your command.
--
Stéphane |
|
| Back to top |
|
 |
Kevin Collins *nix forums Guru Wannabe
Joined: 11 Mar 2005
Posts: 216
|
Posted: Fri May 12, 2006 5:14 pm Post subject:
Re: Array Processing Please Help
|
|
|
In article <1147404466.382843.302380@j73g2000cwa.googlegroups.com>, BN wrote:
| Quote: |
Chris F.A. Johnson wrote:
On 2006-05-12, BN wrote:
Greetings Chris,
Here is the command:
set -A B $(echo "port $Port \n show post queue $Queue detail" |sp_ctrl
|egrep -i '^o\.| Redo log:| Log offset:|read rele
ased |hit count|Insert operations|Update operations|Delete
operations|at' |egrep -v 'Since|Operations')
I have multiple ports:
Port=" 1 2 3 4 5 6"
Each Port can have multiple Queue.
I run them in a double "for" loop to process all the queues for a given
port
here are 2 different outputs:
What do you want to do with that output?
Please note that Google groups is a front end to Usenet newsgroups.
Please read <http://cfaj.freeshell.org/google> for information on
posting correctly from Google.
When state != Idle
o.xyzacd Running 19936822 08-May-06 09:26:59 161
112
Last operation posted:
Redo log: 5491 Log offset: 101466192
INSERT in "SCOTT"."DEPT" at 05/11/06 21:45:03
Post state : Commit transaction
Activation Id : 4
Number of messages read released : 374712781
Insert operations : 7920317
Update operations : 3042954
Delete operations : 2110956
Key cache hit count : 924366
SQL cache hit count : 75 %
When State=Idle
o.xyzacd Running 19942311 08-May-06 09:26:59 2
0
Last operation posted:
Redo log: 5491 Log offset: 116285104
INSERT in "SCOTT"."EMPLOYEE" at 05/11/06 21:47:52
Post state : Idle
Activation Id : 4
Number of messages read released : 374718326
Insert operations : 7922286
Update operations : 3043820
Delete operations : 2111593
Key cache hit count : 924669
SQL cache hit count : 75 %
If you want I can send you the full script.
That would be good, as would quoting context when you reply.
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
Greetings,
I apologize for not following the Usenet netiquette
Thank you for the link.
I insert the output into an Oracle Database:
Full Script:
HOST_NAME=$(hostname)
PORT_NUMBER="1 2 3 4 5 6 7 8"
SP_CTRL="/apps/opt/splex/product/4.0/bin/sp_ctrl"
echo "\nREM Host=$HOST_NAME Date:`date`\n" >/tmp/bn1.sql
for Port in $PORT_NUMBER
do
# Get the queue name for all the given ports
QUEUE=$(echo "port $Port \n qstatus " |$SP_CTRL |egrep -i Name
|cut -f5 -d" ")
# for each port and each queue get the stats and store them in the
Database
for Queue in ${QUEUE}
do
echo "\nREM Port=$Port Queue=$Queue \n" >>bn1.sql
set -A B $(echo "port $Port \n show post queue $Queue detail" |$SP_CTRL
|egrep -i '^o\.| Redo log:| Log offset:|re
ad released |hit count|Insert operations|Update operations|Delete
operations|at' |egrep -v 'Since|Operations')
if [ "${B[25]}" = "Idle" ]
then
cat <<EOF >>/tmp/bn1.sql
insert into scott.my_stats
(HOST_NAME, INSTANCE_NAME, QUEUE_NAME, PORT_NUMBER,
STATUS, OPERATIONS_POSTED, POST_START_DATE,
TOTAL, BACKLOG, REDO_LOG,
LOG_OFFSET, LAST_OPERATION_POSTED_DATE,
LAST_OPERATION,
INSERTS, UPDATES, DELETES, SQL_CACHE_HIT_PERCENT, LAST_COLLECTED)
values
('${HOST_NAME}', '$ORACLE_SID', '$Queue', $Port,
'${B[1]}', ${B[2]}, to_date('${B[3]} ${B[4]}','DD-MON-YY
hh24:mi:ss'),
${B[5]}, ${B[6]}, ${B[12]},
${B[15]}, to_date('${B[20]} ${B[21]}','MM/DD/YY hh24:mi:ss'),
'${B[16]} ${B[17]} ${B[18]} ${B[19]} ${B[20]} ${B[21]}',
${B[40]}, ${B[44]}, ${B[48]}, ${B[60]}, sysdate);
commit;
EOF
else
cat <<EOF >>/tmp/bn1.sql
insert into scott.my_stats
(HOST_NAME, INSTANCE_NAME, QUEUE_NAME, PORT_NUMBER,
STATUS, OPERATIONS_POSTED, POST_START_DATE,
TOTAL, BACKLOG, REDO_LOG,
LOG_OFFSET, LAST_OPERATION_POSTED_DATE,
LAST_OPERATION,
INSERTS, UPDATES, DELETES, SQL_CACHE_HIT_PERCENT, LAST_COLLECTED)
values
('${HOST_NAME}', '$ORACLE_SID', '$Queue', $Port,
'${B[1]}', ${B[2]}, to_date('${B[3]} ${B[4]}','DD-MON-YY
hh24:mi:ss'),
${B[5]}, ${B[6]}, ${B[12]},
${B[15]}, to_date('${B[20]} ${B[21]}','MM/DD/YY hh24:mi:ss'),
'${B[16]} ${B[17]} ${B[18]} ${B[19]} ${B[20]} ${B[21]}',
${B[41]}, ${B[45]}, ${B[49]}, ${B[61]}, sysdate);
commit;
EOF
fi
done
done
# Insert the values into the DB
echo "/ as sysdba \n @/tmp/bn1.sql"|sqlplus -S
|
Ok, I don't think anyone is going to re-write that script for you, but a much
better approach would be to do something along these lines:
echo "port $Port \n show post queue $Queue detail" |$SP_CTRL | while read line
do
case $line in
"Insert operations"*) ins_ops=${line##*: } ;;
"Update operations"*) upd_ops=${line##*: } ;;
"Delete operations"*) del_ops=${line##*: } ;;
... excercise in coding for YOU
... add more logic to match all various values
esac
done
So, instead of relying on a "shifting" array, you grab specifically what you
want. Then, your INSERT statement can use the variables you define, and not
array elements, and you can eliminate the "if idle or not" logic...
Personally, I'd use perl or awk to parse this rather than ksh, but that's me :)
Kevin
--
Unix Guy Consulting, LLC
Unix and Linux Automation, Shell, Perl and CGI scripting
http://www.unix-guy.com |
|
| Back to top |
|
 |
William James *nix forums Guru Wannabe
Joined: 01 Jul 2005
Posts: 229
|
Posted: Tue May 23, 2006 6:37 pm Post subject:
Re: print from a field to EOL
|
|
|
Chris F.A. Johnson wrote:
| Quote: | On 2006-05-23, Harlan Grove wrote:
kpcamp wrote...
Ok I am trying to create a file from output field "3" and "9 to EOL"
while read line;do
ls -ltr "${line}" |awk {'print$3":"$9'} #Need to have $9 to EOL
done < $file
This really belongs in comp.unix.shell. Followup set.
while read line;do
ls -ltr "${line}"
done < "$file" | tr -s ' ' | cut -d ' ' -f3,9-
Or:
IFS='
'
ls -ltr $( cat "$file" ) | tr -s ' ' | cut -d ' ' -f3,9-
...
Since you're dealing with ls output, your fields are fixed length.
Modern versions of ls do not produce fixed-length fields; they
produce whitespace-separated fields. The actual width of any field
(except the last) is determined by the longest entry in the field.
Use substr to get the substring of $0 beginning at the first
character of $9 and print that rather than $9.
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
|
ruby -ane 'puts $F.values_at(2,8..-1).join(" ")' |
|
| Back to top |
|
 |
Kenny McCormack *nix forums Guru
Joined: 24 Mar 2005
Posts: 657
|
Posted: Sun Jun 04, 2006 3:09 pm Post subject:
Re: How to Determine my Internet IP Address
|
|
|
In article <em2bl3-je3.ln1@don.localnet>,
Bill Marcum <bmarcum@iglou.com> wrote:
| Quote: | ["Followup-To:" header set to comp.unix.shell.]
On Sun, 04 Jun 2006 10:57:16 GMT, Dave Farrance
DaveFarrance@OMiTTHiSyahooANDTHiS.co.uk> wrote:
I'm looking for a reasonably future-proof way to find the IP address of
a machine as seen from the Internet.
....
ifconfig
|
Every question has an answer that is simple, obvious, straightforward, and ...
WRONG!
The whole point is that nowadays most machines are behind some kind of
NAT/firewall and so the "real" IP address is not the one that the
NIC is configured to.
To the OP: If you can FTP to somewhere, try "quote stat". |
|
| Back to top |
|
 |
Dave Farrance *nix forums Guru Wannabe
Joined: 21 Feb 2005
Posts: 294
|
Posted: Sun Jun 04, 2006 3:09 pm Post subject:
Re: How to Determine my Internet IP Address
|
|
|
Bill Marcum <bmarcum@iglou.com> wrote:
Yeah but I wanted the address as seen by the Internet rather than one
that might be assigned by a local network router.
--
Dave Farrance |
|
| Back to top |
|
 |
Dave Farrance *nix forums Guru Wannabe
Joined: 21 Feb 2005
Posts: 294
|
Posted: Sun Jun 04, 2006 5:01 pm Post subject:
Re: How to Determine my Internet IP Address
|
|
|
gazelle@xmission.xmission.com (Kenny McCormack) wrote:
| Quote: | To the OP: If you can FTP to somewhere, try "quote stat".
|
Another interesting alternative. I guess this is a bit fragile because
it's dependent on the syntax of the current ftp for Linux.
#!/bin/bash
{
ftp -inuv <<eof
open ftp.proxad.net
user anonymous xx@xx.invalid
quote stat
quit
eof
} | awk '/ Connected to/{print $NF}'
--
Dave Farrance |
|
| Back to top |
|
 |
Kenan Kalajdzic *nix forums beginner
Joined: 29 Apr 2006
Posts: 31
|
Posted: Mon Jun 05, 2006 9:05 pm Post subject:
Re: How to Determine my Internet IP Address
|
|
|
In comp.unix.shell Dave Farrance <DaveFarrance@omitthisyahooandthis.co.uk> wrote:
| Quote: | I'm looking for a reasonably future-proof way to find the IP address of
a machine as seen from the Internet.
This worked once but not now. It was probably removed due to excessive
traffic:
wget -O- http://cfaj.freeshell.org/ipaddr.cgi 2>/dev/null
Other suggestions please?
|
Try using 'ping' with the IP record route option:
ping -c 1 -R www.internic.net
then simply parse the output and extract the IP address of your router's
external interface. Note, however, that this method may not prove more
reliable than using HTTP. It can at least serve as an alternative.
--
Kenan Kalajdzic |
|
| Back to top |
|
 |
Dave Farrance *nix forums Guru Wannabe
Joined: 21 Feb 2005
Posts: 294
|
Posted: Tue Jun 06, 2006 10:58 am Post subject:
Re: How to Determine my Internet IP Address
|
|
|
Kenan Kalajdzic <kenan@cced.ba> wrote:
| Quote: | Try using 'ping' with the IP record route option:
ping -c 1 -R www.internic.net
then simply parse the output and extract the IP address of your router's
external interface. Note, however, that this method may not prove more
reliable than using HTTP. It can at least serve as an alternative.
|
Its position in the list depends on the number of routers (if any).
Displaying the whole list can be useful, but I don't see a way to
reliably extract the Internet-facing IP with a script.
--
Dave Farrance |
|
| Back to top |
|
 |
Kenan Kalajdzic *nix forums beginner
Joined: 29 Apr 2006
Posts: 31
|
Posted: Tue Jun 06, 2006 11:03 am Post subject:
Re: How to Determine my Internet IP Address
|
|
|
Dave Farrance <DaveFarrance@omitthisyahooandthis.co.uk> wrote:
| Quote: | Kenan Kalajdzic <kenan@cced.ba> wrote:
Try using 'ping' with the IP record route option:
ping -c 1 -R www.internic.net
then simply parse the output and extract the IP address of your router's
external interface. Note, however, that this method may not prove more
reliable than using HTTP. It can at least serve as an alternative.
Its position in the list depends on the number of routers (if any).
Displaying the whole list can be useful, but I don't see a way to
reliably extract the Internet-facing IP with a script.
|
You are right, it could be a challenge. However, in most cases you can
assume that the first public (routable) address in the list is the one
that is seen from the Internet.
--
Kenan Kalajdzic |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Tue Dec 02, 2008 5:23 am | All times are GMT
|
|
Mortgage | Loan | Credit Card Consolidation | Loans | Homeowner Loans
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|