03-23-2005
Hi Gundu. Try this:
LIST="`awk '{ print $NF }' portfile`"
if netstat -a |egrep -s "$LIST"
then
echo "do this"
else
echo "do that"
fi
Hope this helps.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Friends,
Can anyone help me with comparing the records in twofiles,
I have two files (csv)
FILE1:
1023,SMITH JAMES , (203) 789-1249
1023,HARRY POTTER , (213) 789-1249
1023,JONES D, (903) 789-1249
FILE1:
1023,SMITH ,2037891249
1023,HARRY , 2137891249
1023,JONES, 7037891249
... (14 Replies)
Discussion started by: sbasetty
14 Replies
2. Shell Programming and Scripting
I am new to unix and need to learn how to compare a variable $subject to a string pattern. If the variable has the word "Item" in it then it should be true. How do I do this? Currently I am using the Bourne shell but I can also use Korn or Bash.
I come from a Rexx background where strings are... (2 Replies)
Discussion started by: jerryte
2 Replies
3. Shell Programming and Scripting
i have two files:
file1.txt
AA
BB
DD
EE
file2.txt
AA,AAA
BB,BBB
CC,CCC
DD,DDD
EE,EEE
FF,FFF
i want an output file:
file3.txt
AA,AAA
BB,BBB (2 Replies)
Discussion started by: MiLKTea
2 Replies
4. Shell Programming and Scripting
how can i campare te length of the string
$var = unix
if ( $var -eq 4 )
then..
is it right (6 Replies)
Discussion started by: mail2sant
6 Replies
5. Shell Programming and Scripting
Hi everybody.
I have this comand "/usr/local/check_procs myprocess" which prints "OK: myprocess running" on my console if the process is running and "myprocess not running" if it is not.
I am writing a bash script to check if the process is running but am getting an error.
Here is my... (3 Replies)
Discussion started by: kanexxx
3 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have a variable with value tmp2=123.45.175.243, I am taking this value from a network file.
In the script I need to check whether the variable has only numerals and .(dot).
if ..." ]
then
printf "SUCCESS\n"
else
printf "FAILED\n"
fi
doesnt work, is there a alternate... (1 Reply)
Discussion started by: happyrain
1 Replies
7. Shell Programming and Scripting
Hi i have a bash script which calls a PHP script (comparison_cron.php).
The php script prints the string "no_data_to_retrieve" without quotes.
Why does the following bash script not leave the while loop?
#!/bin/bash
cronOutput=$(php /srv/www/vhosts/xyz/httpdocs/comparison_cron.php)... (2 Replies)
Discussion started by: kaphiphi
2 Replies
8. Shell Programming and Scripting
Hi,
I have file like below,
Srinivas Jala Srinivas Jala AA
Srikanth ML Srikanth ML KK
Vijay Kumar Dha Vijay Kumar Dha JJ
i want to compare like "Srinivas Jala" word in same line, if i found i shoud get some like found, or not found. Pls help to get the code. (3 Replies)
Discussion started by: Srinivas.Jala
3 Replies
9. Shell Programming and Scripting
Dear all
Would anyone tell me how to prevent user from input non asterisk(i.e. *) character via keyboard?
#!/bin/ksh
targetHour=-1
while ]
do
echo "Please input target hour":
read targetHour
done
When I execute the above coding, and then input a "j", it return the following... (3 Replies)
Discussion started by: cstsang
3 Replies
10. UNIX for Beginners Questions & Answers
I have below code inside my awk script
if ( $0 ~ /SVC IN:/ )
{
svc_in=substr( $0,23 , 3);
if (msg_start == 1 && msg_end == 0)
{
msg_arr=$0;
}
}
else if ( $0 ~ /^SVC OUT:/ )
{
svc_out=substr( $0, 9, 3);
if (msg_start == 1 && msg_end == 0)
... (6 Replies)
Discussion started by: bhagya123
6 Replies
LEARN ABOUT MINIX
inet_type
inet_type(4) File Formats inet_type(4)
NAME
inet_type - default Internet protocol type
SYNOPSIS
/etc/default/inet_type
DESCRIPTION
The inet_type file defines the default IP protocol to use. Currently this file is only used by the ifconfig(1M) and netstat(1M) commands.
The inet_type file can contain a number of <variable>=<value> lines. Currently, the only variable defined is DEFAULT_IP, which can be
assigned a value of IP_VERSION4, IP_VERSION6, or BOTH.
The output displayed by the ifconfig and netstat commands can be controlled by the value of DEFAULT_IP set in inet_type file. By default,
both commands display the IPv4 and IPv6 information available on the system. The user can choose to suppress display of IPv6 information by
setting the value of DEFAULT_IP. The following shows the possible values for DEFAULT_IP and the resulting ifconfig and netstat output that
will be displayed:
IP_VERSION4 Displays only IPv4 related information. The output displayed is backward compatible with older versions of the ifconfig(1M)
and netstat(1M) commands.
IP_VERSION6 Displays both IPv4 and IPv6 related information for ifconfig and netstat.
BOTH Displays both IPv4 and IPv6 related information for ifconfig and netstat.
The command-line options to the ifconfig and netstat commands override the effect of DEFAULT_IP as set in the inet_type file. For example,
even if the value of DEFAULT_IP is IP_VERSION4, the command
example% ifconfig -a6
will display all IPv6 interfaces.
EXAMPLES
Example 1: Suppressing IPv6 Related Output
This is what the inet_type file must contain if you want to suppress IPv6 related output:
DEFAULT_IP=IP_VERSION4
SEE ALSO
ifconfig(1M), netstat(1M)
SunOS 5.10 16 Jun 1999 inet_type(4)