11-12-2014
@RudiC
I would like execute a command as below.
ssh user@host " AWK Command "
But the AWK command should be flexible enough to compare the pattern with column which is passed as input.
For example :
For below o/p i want to check for pattern 9511 in only 2nd column or only 1st column.
I need to pass the column as i/p variable to awk and compare with the pattern.
$ netstat -an | grep 951
200.103.10.10.50224 100.103.10.10.9511 49640 0 49640 0 ESTABLISHED
200.103.10.10.50263 100.103.10.10.9512 49640 0 49640 0 ESTABLISHED
200.103.10.10.50278 100.103.10.10.9513 49640 0 49640 0 ESTABLISHED
200.103.10.10.50292 100.103.10.10.9514 49640 0 49640 0 ESTABLISHED
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi all,
i'm trying to pass a count of files to a variable thru these set of codes:
sh_count=$(ls -1 fnd_upload_LV*.* |wc -l)
problem is if no files matches that, it will give an error "ls: fnd_upload_LV*.*: No such file or directory".
how do i avoid having the shell script show that... (2 Replies)
Discussion started by: adshocker
2 Replies
2. Shell Programming and Scripting
Hi,
I'm trying to compare the value in a field to the value in a variable using awk. This works:
awk '$7 == "101"'but this is what I want (and it doesn't work):
value=101
awk '$7 == "$value"'
Any help or insight on this would be great. Thanks in advance. (1 Reply)
Discussion started by: goodbenito
1 Replies
3. Shell Programming and Scripting
Hi,
I have a program written in awk and I want to extend it to do another task.
My program is a list of CVS log reports of a repository. For each file, I have some fields. One of the fields is the comment field. I want to know how I can check if a comment (which is a free text field)... (8 Replies)
Discussion started by: sandeepk1611
8 Replies
4. Solaris
Hi guys,
I usualy am able to google awk stuff but I can't find it so far and there are so many awking gurus here that I will give it a shot.
I want to print $1;$3;"$5 up to the $NF". In other words, I can have 1000 colums, but need to have $5 up to the end.
I started with the idea of... (2 Replies)
Discussion started by: plmachiavel
2 Replies
5. Shell Programming and Scripting
Hello,
I am trying to redirect files to a directory by using a config file. The config files is as such:
xxxxxx,ID,PathToDirectory
xxxxxx,ID2,PathToDirectory2
and so on...
I have a variable that should match one of these IDs. I want to load this config file into an awk array, and... (2 Replies)
Discussion started by: jrfiol
2 Replies
6. Red Hat
num=10
sed -n '$num p' test.txt
sed -n '10 p' test.txt works
however i am putting the sed command in a loop and the line number is not static
Can someone please help me how to achive this. (1 Reply)
Discussion started by: figure20012
1 Replies
7. Shell Programming and Scripting
Input file :
5 20
500 2
20 41
41 0
23 1
Desired output :
5
2
20
0
1
By comparing column 1 and 2 in each line, I hope can print out the column with smallest number.
I did try the following code, but it don't look good :( (2 Replies)
Discussion started by: perl_beginner
2 Replies
8. UNIX for Advanced & Expert Users
I must have forgot how to do this, but, I am attempting to enter a variable into an awk / gawk search pattern.
I am getting a value from user input to place in a specific section of a 132 character string.
my default command is ....
gawk --re-interval '/^(.{3}P .{4}CYA.{8}1)/' ... (3 Replies)
Discussion started by: sdeevers
3 Replies
9. Shell Programming and Scripting
I'm interested to match column pattern through awk using an external variable for data:
-9 1:751343:T:A -9 0 T A 0.726 -5.408837e-03 9.576603e-03 7.967536e-01 5.722312e-01
-9 1:751756:T:C -9 0 T C 0.727 -5.360458e-03 9.579447e-03 7.966977e-01 5.757858e-01... (7 Replies)
Discussion started by: genome
7 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 SUNOS
wrsmconf
wrsmconf(1M) System Administration Commands wrsmconf(1M)
NAME
wrsmconf - manage WCI RSM controller configurations
SYNOPSIS
/usr/platform/sun4u/sbin/wrsmconf create -c controller_id -f config_file
wrsmconf initial -f config_file [ -c controller_id]
wrsmconf remove [ -c controller_id]
wrsmconf topology [ -c controller_id]
wrsmconf dump -c controller_id -f config_file
DESCRIPTION
wrsmconf provides a means to create, install, retrieve, and remove configurations for WCI remote shared memory (RSM) controllers.
OPTIONS
The following options are supported:
create -c controller_id -f config_file
Create a set of per-node configurations for the specified controller and store them to the file config_file. The created file contains
a per-node configuration for each node specified in the input for the specified controller. The file has a checksum on it and cannot be
modified directly. This file can be used in a wrsmconf initial call on each node to install the node's configuration into the local
driver.
A list of nodes and WCI devices connected to those nodes is read from standard input. For each connected pair of links, specify the
nodename (uname -n), safari port id, and link number on both sides of the connection. The format of the information looks like this:
<nodename>.<wrsm-portid>.<linkno>=<nodename>.<wrsm-portid>.<linkno>
<nodename>.<wrsm-portid>.<linkno>=<nodename>.<wrsm-portid>.<linkno>
This interface is intended for installing configurations for testing (such as for SunVTS). Only direct-connect, non-striped configura-
tions for 1 to 3 nodes can be specified. FM node ids and RSM hardware addresses are assigned to the specified nodes contiguously and in
order starting from 0.
initial -f config_file [-c controller_id]
Install the configuration for the local node stored in the file config_file into the driver as the initial configuration for the speci-
fied controller. This command fails under the following circumstances:
o If controller_id is specified and the configuration in the file is not for the specified controller.
o If the file does not contain a valid configuration for the local node or if the checksum in the file shows it has been modified.
o If a configuration has already been installed for the controller. If this happens, use wrsmconf remove to remove the existing con-
figuration.
remove [ -c controller_id ]
Disable communication through the installed configuration for all controllers or the specified controller and remove the configura-
tion(s) from the driver.
topology -c controller_id
For each installed controller (or for the specified controller), print to stdout the set of nodes this controller is configured to
reach, including the nodename, FM node id, and RSM hardware address for each node. The following is example output:
FM Node ID Node Name Controller Instance Controller HW Addr
0 hpc00 0 101
0 hpc00 1 333
1 hpc01 0 102
1 hpc01 1 54
1 hpc01 2 34
2 hpc03 0 103
2 hpc03 1 103
2 hpc03 2 103
dump -c controller-id -f config_file
Fetch the installed configuration for the specified controller from the driver and store it into the file config_file along with a
checksum to protect the data. This configuration can later be installed with the command wrsmconf initial.
EXIT STATUS
This command returns 0 on successful completion, and a non-zero value if an error occured.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWwrsm |
+-----------------------------+-----------------------------+
SEE ALSO
kstat(1M), wrsmstat(1M), attributes(5)
SunOS 5.10 25 Jun 2003 wrsmconf(1M)