Match column 8 in file 1 with column 2 in file 2 and replace..
I am looking at the NR==FNR posts and trying to use them to achieve the following but I am not getting it.
I have 2 files. I want to match column 8 in file 1 with column 2 in file 2. When they match I want to replace column 9 in file 1 with column 1 in file 2.
This is and extract from file 1
This is file 2
So in this example I want to replace HOSTNAME_INFO in file 1 with SEIESXPD21 when 20000025b550137d in column 8 in file 1 matches column 2 in file 2. and the same goes for 20000025b55011dc. I want to replace HOSTNAME_INFO with SEIESXPD22 in file 1.
The output should look like this.
I have tried the following
But I am getting a blank entry for column 9 in file 1 when I do this. That is when the matching occurs. Can somebody please help me with this?
Hi, Iam new to unix. I have one input file .
Input file :
ID1~Name1~Place1
ID2~Name2~Place2
ID3~Name3~Place3
I need output such that only first column should change to fixed width column of 15 characters of length.
Output File:
ID1<<12 spaces>>Name1~Place1
ID2<<12... (5 Replies)
Hi,
I have two files. 1st file has 1 column (huge file containing ~19200000 lines) and 2nd file has 2 columns (small file containing ~6000 lines).
#################################
huge_file.txt
a
a
ab
b
##################################
small_file.txt
a 1.5
b 2.5
ab ... (4 Replies)
Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2
file 1 sample
SNDK 80004C101 AT
XLNX 983919101 BB
NETL 64118B100 BS
AMD 007903107 CC
KLAC 482480100 DC
TER 880770102 KATS
ATHR 04743P108 KATS... (7 Replies)
Hello,
I am trying to replace the column in file1 with the column from file2. The two files will have the same amount of rows. Each row will correspond with the same row in the other file.
File1
"Replace this column"
500 13-APR-2011... (11 Replies)
Can anyone please help with this? I have 2 files as given below.
If 2nd column of file1 has pattern foo1@a, find the matching 1st column in file2 & replace 2nd column of file1 with file2's value.
file1
abc_1 foo1@a ....
abc_1 soo2@a ...
def_2 soo2@a ....
def_2 foo1@a ........ (7 Replies)
hi
I have 2 file with more than 10 columns for both
1st file
apple,0,0,0......
orange,1,2,3.....
mango,2,4,5.....
2nd file
apple,2,3,4,5,6,7...
orange,2,3,4,5,6,8...
watermerlon,2,3,4,5,6,abc...
mango,5,6,7,4,6,def.... (1 Reply)
Discussion started by: tententen
1 Replies
LEARN ABOUT SUSE
smp_phy_control
SMP_PHY_CONTROL(8) SMP_UTILS SMP_PHY_CONTROL(8)NAME
smp_phy_control - invoke PHY CONTROL SMP function
SYNOPSIS
smp_phy_control [--attached=ADN] [--expected=EX] [--help] [--hex] [--interface=PARAMS] [--max=MA] [--min=MI] [--op=OP] [--phy=ID]
[--pptv=TI] [--raw] [--sa=SAS_ADDR] [--verbose] [--version] SMP_DEVICE[,N]
DESCRIPTION
Sends a SAS Management Protocol (SMP) PHY CONTROL request function to a SMP target. The SMP target is identified by the SMP_DEVICE and the
SAS_ADDR. Depending on the interface, the SAS_ADDR may be deduced from the SMP_DEVICE. With one interface there is one SMP_DEVICE per
machine so the SMP_DEVICE,N syntax is needed to differentiate between HBAs if there are multiple present.
The PHY CONTROL function is used to change the state of a phy within a SMP target. SMP targets are typically SAS expanders which have mul-
tiple phys. Certain operation values (e.g. 'lr' (link reset) and 'hr' (hard reset)) change the state of the attached phy. Sending such
operation values to the phy in the SMP target that is attached to the originator (i.e. the SMP initiator) may lead to a bad response.
Invoking this utility with no arguments (other than SMP_DEVICE which might be in an environment variable and --sa=SAS_ADDR which might be
in an environment variable or not needed) is harmless. In other words a phy's state is only changed when either --max=MA, --min=MI, --op=OP
or --pptv=TI is given with a non default value.
OPTIONS
Mandatory arguments to long options are mandatory for short options as well.
-a, --attached=ADN
specifies the attached device name (ADN). The default value is 0 . The ADN is in decimal but is likely to be a SAS address which is
typically shown in hexadecimal. To specify a number in hexadecimal either prefix it with '0x' or put a trailing 'h' on it.
-E, --expected=EX
set the 'expected expander change count' field in the SMP request. The value EX is from 0 to 65535 inclusive with 0 being the
default value. When EX is greater than zero then if the value doesn't match the expander change count of the SMP target (i.e. the
expander) when the request arrives then the target ignores the request and sets a function result of "invalid expander change count"
in the response.
-h, --help
output the usage message then exit.
-H, --hex
output the response in hexadecimal.
-I, --interface=PARAMS
interface specific parameters. In this case "interface" refers to the path through the operating system to the SMP initiator. See
the smp_utils man page for more information.
-M, --max=MA
permits the programmed maximum physical link rate to be changed on the gven phy. Permitted values are: 0 -> no change, 8 -> 1.5
Gbps, 9 -> 3 Gbps, 10 -> 6 Gbps. Default value is 0.
-m, --min=MI
permits the programmed minimum physical link rate to be changed on the given phy. Permitted values are: 0 -> no change, 8 -> 1.5
Gbps, 9 -> 3 Gbps, 10 -> 6 Gbps. Default value is 0.
-o, --op=OP
specifies the operation to be performed on the given phy. The OP argument can be either numeric or a string. If a number is given,
it is put into the 'phy operation' field of the request. Allowable strings are abbreviations of which only the first two characters
need to match. The supported strings are: 'nop' (no operation), 'lr' (link reset), 'hr' (hard reset), 'dis' (disable phy), 'cel'
(clear error log), 'ca' (clear affiliation), 'tspss' (transmit SATA port selection signal), 'citnl' (clear STP I_T nexus loss
(bit)), and 'sadn' (set attached device name). The default value is 0 (no operation).
-p, --phy=ID
phy identifier. ID is a value between 0 and 127. Default is 0.
-P, --pptv=TI
partial pathway timeout value. The units are microseconds and the permitted values are between 0 and 15 inclusive. 7 microseconds is
recommended by sas2r07.
-r, --raw
send the response to stdout in binary. All error messages are sent to stderr.
-s, --sa=SAS_ADDR
specifies the SAS address of the SMP target device. Typically this is an expander. This option may not be needed if the SMP_DEVICE
has the target's SAS address within it. The SAS_ADDR is in decimal but most SAS addresses are shown in hexadecimal. To give a number
in hexadecimal either prefix it with '0x' or put a trailing 'h' on it.
-v, --verbose
increase the verbosity of the output. Can be used multiple times
-V, --version
print the version string and then exit.
CONFORMING TO
The SMP PHY CONTROL function was introduced in SAS-1 .
AUTHORS
Written by Douglas Gilbert.
REPORTING BUGS
Report bugs to <dgilbert at interlog dot com>.
COPYRIGHT
Copyright (C) 2006-2008 Douglas Gilbert
This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR-
POSE.
SEE ALSO
smp_utils, smp_discover(smp_utils)
smp_utils-0.93 January 2008 SMP_PHY_CONTROL(8)