Sponsored Content
Top Forums Shell Programming and Scripting How to replace the last pattern using sed? Post 302508864 by vistastar on Tuesday 29th of March 2011 10:05:30 AM
Old 03-29-2011
don't use the eee after AAA,because it may not be eee.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find a pattern and replace using sed.

Hi I need to help on finding the below pattern using sed <b><a href="/home/document.do?assetkey=x-y-abcde-1&searchclause=photo"> and replace as below in the same line on the index file. <b><a href="/abcde.html"> thx in advance. Mari (5 Replies)
Discussion started by: maridhasan
5 Replies

2. Shell Programming and Scripting

SED Search Pattern and Replace with the Pattern

Hello All, I have a string "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031", and I just want to extract LLSV1, but I dont get the expected result when using the sed command below. # echo "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031" | awk '{print... (4 Replies)
Discussion started by: racbern
4 Replies

3. Shell Programming and Scripting

Pattern Replace using sed or awk

Hi , My file have data like 4:ALMOST NEVER PR 1925836 5:NEVER PR W DDA 5857610 6:NEVER PR WO DDA 26770205 but i want to replace the spaces before last numric digits out put should be like this 4:ALMOST NEVER PR=1925836 5:NEVER PR W DDA=5857610 6:NEVER PR WO... (7 Replies)
Discussion started by: max_hammer
7 Replies

4. Shell Programming and Scripting

Replace everything but pattern in a line using sed

I have a file with multiple lines like this: <junk><PATTERN><junk><PATTERN><junk> <junk><PATTERN><junk><PATTERN><junk><PATTERN><junk> Note that 1. There might be variable number occurrences of PATTERN in a line. 2. <> are just placeholders, they do not form part of the pattern. I need... (4 Replies)
Discussion started by: flatley
4 Replies

5. Shell Programming and Scripting

sed to replace pattern with filename

Hi all, I'm trying to replace a pattern/string in about 100 files with the filename using following commands but getting nowhere: for f in *.fa; do sed "s/^>.*/>$f/g" $f > $f_v1.fa; done for f in *.fa; do sed 's/^>.*/>`echo $f`/' > $fa_v1.fa; done Basically I want to change any line... (5 Replies)
Discussion started by: ivpz
5 Replies

6. Shell Programming and Scripting

sed command to replace two character pattern with another pattern

Not able to paste my content. Please see the attachment :-( (2 Replies)
Discussion started by: vivek d r
2 Replies

7. Shell Programming and Scripting

sed find/replace a pattern, but not this one..

I've got a file like so: ...lots of lines, etc. push "route 10.8.0.0 255.255.255.0" push "route 192.168.1.123 255.255.255.0" ...lots of lines, etc. I want to sed find/replace the IP address in the second line, whatever it is, with a new IP address, but I don't want to touch the first line.... (5 Replies)
Discussion started by: DaHai
5 Replies

8. Shell Programming and Scripting

sed - Search and replace within pattern

Hi Guys! Unix newbie here! Have a requirement for which I have been scouting the forums for a solution but has been out of luck so far :( I have a file which contains the following:- TEST1|TEST2|"TEST3|1@!2"|TEST5 My sed command should result in either one the following output:-... (6 Replies)
Discussion started by: hishamzz
6 Replies

9. UNIX for Beginners Questions & Answers

sed replace pattern

I have a file with multiple lines, all in the same format. For each line, I need to replace the sequence of digits after the last : with a new value, but keep the single quote at the end of the line. Example: Input: ( two lines of file) Name: 'text1:200/text2:1.2.3.4' Name2:... (19 Replies)
Discussion started by: Beginner101
19 Replies

10. UNIX for Beginners Questions & Answers

Find pattern and replace using sed

Hi, i want to replace the following lines in such a way that if the word merge exists in first column it must replace the 3rd column as M and if parse exists in first column then the last column must P, if neither it must mark it as X. I have tried the solution using awk, but it is saying... (6 Replies)
Discussion started by: charlie87
6 Replies
ETHTOOL(8)						      System Manager's Manual							ETHTOOL(8)

NAME
ethtool - query or control network driver and hardware settings SYNOPSIS
ethtool devname ethtool -h|--help ethtool --version ethtool -a|--show-pause devname ethtool -A|--pause devname [autoneg on|off] [rx on|off] [tx on|off] ethtool -c|--show-coalesce devname ethtool -C|--coalesce devname [adaptive-rx on|off] [adaptive-tx on|off] [rx-usecs N] [rx-frames N] [rx-usecs-irq N] [rx-frames-irq N] [tx-usecs N] [tx-frames N] [tx-usecs-irq N] [tx-frames-irq N] [stats-block-usecs N] [pkt-rate-low N] [rx-usecs-low N] [rx-frames-low N] [tx-usecs-low N] [tx-frames-low N] [pkt-rate-high N] [rx-usecs-high N] [rx-frames-high N] [tx-usecs-high N] [tx-frames-high N] [sample-interval N] ethtool -g|--show-ring devname ethtool -G|--set-ring devname [rx N] [rx-mini N] [rx-jumbo N] [tx N] ethtool -i|--driver devname ethtool -d|--register-dump devname [raw on|off] [hex on|off] [file name] ethtool -e|--eeprom-dump devname [raw on|off] [offset N] [length N] ethtool -E|--change-eeprom devname [magic N] [offset N] [length N] [value N] ethtool -k|--show-features|--show-offload devname ethtool -K|--features|--offload devname feature on|off ... ethtool -p|--identify devname [N] ethtool -P|--show-permaddr devname ethtool -r|--negotiate devname ethtool -S|--statistics devname ethtool -t|--test devname [offline|online|external_lb] ethtool -s devname [speed N] [duplex half|full] [port tp|aui|bnc|mii] [mdix auto|on|off] [autoneg on|off] [advertise N] [phyad N] [xcvr internal|external] [wol p|u|m|b|a|g|s|d...] [sopass xx:yy:zz:aa:bb:cc] [msglvl N | msglvl type on|off ...] ethtool -n|-u|--show-nfc|--show-ntuple devname [ rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 | rule N ] ethtool -N|-U|--config-nfc|--config-ntuple devname rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r... | flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4 [src xx:yy:zz:aa:bb:cc [m xx:yy:zz:aa:bb:cc]] [dst xx:yy:zz:aa:bb:cc [m xx:yy:zz:aa:bb:cc]] [proto N [m N]] [src-ip x.x.x.x [m x.x.x.x]] [dst-ip x.x.x.x [m x.x.x.x]] [tos N [m N]] [l4proto N [m N]] [src-port N [m N]] [dst-port N [m N]] [spi N [m N]] [l4data N [m N]] [vlan-etype N [m N]] [vlan N [m N]] [user-def N [m N]] [dst-mac xx:yy:zz:aa:bb:cc [m xx:yy:zz:aa:bb:cc]] [action N] [loc N] | delete N ethtool -w|--get-dump devname [data filename] ethtool -W|--set-dump devname N ethtool -T|--show-time-stamping devname ethtool -x|--show-rxfh-indir devname ethtool -X|--set-rxfh-indir devname [ equal N | weight W0 W1 ... ] ethtool -f|--flash devname file [N] ethtool -l|--show-channels devname ethtool -L|--set-channels devname [rx N] [tx N] [other N] [combined N] ethtool -m|--dump-module-eeprom|--module-info devname [raw on|off] [hex on|off] [offset N] [length N] ethtool --show-priv-flags devname ethtool --set-priv-flags devname flag on|off ... ethtool --show-eee devname ethtool --set-eee devname [eee on|off] [tx-lpi on|off] [tx-timer N] [advertise N] DESCRIPTION
ethtool is used to query and control network device driver and hardware settings, particularly for wired Ethernet devices. devname is the name of the network device on which ethtool should operate. OPTIONS
ethtool with a single argument specifying the device name prints current settings of the specified device. -h --help Shows a short help message. --version Shows the ethtool version number. -a --show-pause Queries the specified Ethernet device for pause parameter information. -A --pause Changes the pause parameters of the specified Ethernet device. autoneg on|off Specifies whether pause autonegotiation should be enabled. rx on|off Specifies whether RX pause should be enabled. tx on|off Specifies whether TX pause should be enabled. -c --show-coalesce Queries the specified network device for coalescing information. -C --coalesce Changes the coalescing settings of the specified network device. -g --show-ring Queries the specified network device for rx/tx ring parameter information. -G --set-ring Changes the rx/tx ring parameters of the specified network device. rx N Changes the number of ring entries for the Rx ring. rx-mini N Changes the number of ring entries for the Rx Mini ring. rx-jumbo N Changes the number of ring entries for the Rx Jumbo ring. tx N Changes the number of ring entries for the Tx ring. -i --driver Queries the specified network device for associated driver information. -d --register-dump Retrieves and prints a register dump for the specified network device. The register format for some devices is known and decoded others are printed in hex. When raw is enabled, then ethtool dumps the raw register data to stdout. If file is specified, then use contents of previous raw register dump, rather than reading from the device. -e --eeprom-dump Retrieves and prints an EEPROM dump for the specified network device. When raw is enabled, then it dumps the raw EEPROM data to stdout. The length and offset parameters allow dumping certain portions of the EEPROM. Default is to dump the entire EEPROM. -E --change-eeprom If value is specified, changes EEPROM byte for the specified network device. offset and value specify which byte and it's new val- ue. If value is not specified, stdin is read and written to the EEPROM. The length and offset parameters allow writing to certain portions of the EEPROM. Because of the persistent nature of writing to the EEPROM, a device-specific magic key must be specified to prevent the accidental writing to the EEPROM. -k --show-features --show-offload Queries the specified network device for the state of protocol offload and other features. -K --features --offload Changes the offload parameters and other features of the specified network device. The following feature names are built-in and others may be defined by the kernel. rx on|off Specifies whether RX checksumming should be enabled. tx on|off Specifies whether TX checksumming should be enabled. sg on|off Specifies whether scatter-gather should be enabled. tso on|off Specifies whether TCP segmentation offload should be enabled. ufo on|off Specifies whether UDP fragmentation offload should be enabled gso on|off Specifies whether generic segmentation offload should be enabled gro on|off Specifies whether generic receive offload should be enabled lro on|off Specifies whether large receive offload should be enabled rxvlan on|off Specifies whether RX VLAN acceleration should be enabled txvlan on|off Specifies whether TX VLAN acceleration should be enabled ntuple on|off Specifies whether Rx ntuple filters and actions should be enabled rxhash on|off Specifies whether receive hashing offload should be enabled -p --identify Initiates adapter-specific action intended to enable an operator to easily identify the adapter by sight. Typically this involves blinking one or more LEDs on the specific network port. N Length of time to perform phys-id, in seconds. -P --show-permaddr Queries the specified network device for permanent hardware address. -r --negotiate Restarts auto-negotiation on the specified Ethernet device, if auto-negotiation is enabled. -S --statistics Queries the specified network device for NIC- and driver-specific statistics. -t --test Executes adapter selftest on the specified network device. Possible test modes are: offline Perform full set of tests, possibly interrupting normal operation during the tests, online Perform limited set of tests, not interrupting normal operation, external_lb Perform full set of tests, as for offline, and additionally an external-loopback test. -s --change Allows changing some or all settings of the specified network device. All following options only apply if -s was specified. speed N Set speed in Mb/s. ethtool with just the device name as an argument will show you the supported device speeds. duplex half|full Sets full or half duplex mode. port tp|aui|bnc|mii Selects device port. mdix auto|on|off Selects MDI-X mode for port. May be used to override the automatic detection feature of most adapters. An argument of auto means au- tomatic detection of MDI status, on forces MDI-X (crossover) mode, while off means MDI (straight through) mode. The driver should guarantee that this command takes effect immediately, and if necessary may reset the link to cause the change to take effect. autoneg on|off Specifies whether autonegotiation should be enabled. Autonegotiation is enabled by default, but in some network devices may have trouble with it, so you can disable it if really necessary. advertise N Sets the speed and duplex advertised by autonegotiation. The argument is a hexadecimal value using one or a combination of the fol- lowing values: 0x001 10 Half 0x002 10 Full 0x004 100 Half 0x008 100 Full 0x010 1000 Half (not supported by IEEE standards) 0x020 1000 Full 0x8000 2500 Full (not supported by IEEE standards) 0x1000 10000 Full 0x20000 20000MLD2 Full (not supported by IEEE standards) 0x40000 20000KR2 Full (not supported by IEEE standards) phyad N PHY address. xcvr internal|external Selects transceiver type. Currently only internal and external can be specified, in the future further types might be added. wol p|u|m|b|a|g|s|d... Sets Wake-on-LAN options. Not all devices support this. The argument to this option is a string of characters specifying which op- tions to enable. p Wake on PHY activity u Wake on unicast messages m Wake on multicast messages b Wake on broadcast messages a Wake on ARP g Wake on MagicPackettm s Enable SecureOntm password for MagicPackettm d Disable (wake on nothing). This option clears all previous options. sopass xx:yy:zz:aa:bb:cc Sets the SecureOntm password. The argument to this option must be 6 bytes in Ethernet MAC hex format (xx:yy:zz:aa:bb:cc). msglvl N msglvl type on|off ... Sets the driver message type flags by name or number. type names the type of message to enable or disable; N specifies the new flags numerically. The defined type names and numbers are: drv 0x0001 General driver status probe 0x0002 Hardware probing link 0x0004 Link state timer 0x0008 Periodic status check ifdown 0x0010 Interface being brought down ifup 0x0020 Interface being brought up rx_err 0x0040 Receive error tx_err 0x0080 Transmit error tx_queued 0x0100 Transmit queueing intr 0x0200 Interrupt handling tx_done 0x0400 Transmit completion rx_status 0x0800 Receive completion pktdata 0x1000 Packet contents hw 0x2000 Hardware status wol 0x4000 Wake-on-LAN status The precise meanings of these type flags differ between drivers. -n -u --show-nfc --show-ntuple Retrieves receive network flow classification options or rules. rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 Retrieves the hash options for the specified flow type. tcp4 TCP over IPv4 udp4 UDP over IPv4 ah4 IPSEC AH over IPv4 esp4 IPSEC ESP over IPv4 sctp4 SCTP over IPv4 tcp6 TCP over IPv6 udp6 UDP over IPv6 ah6 IPSEC AH over IPv6 esp6 IPSEC ESP over IPv6 sctp6 SCTP over IPv6 rule N Retrieves the RX classification rule with the given ID. -N -U --config-nfc --config-ntuple Configures receive network flow classification options or rules. rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6m|v|t|s|d|f|n|r... Configures the hash options for the specified flow type. m Hash on the Layer 2 destination address of the rx packet. v Hash on the VLAN tag of the rx packet. t Hash on the Layer 3 protocol field of the rx packet. s Hash on the IP source address of the rx packet. d Hash on the IP destination address of the rx packet. f Hash on bytes 0 and 1 of the Layer 4 header of the rx packet. n Hash on bytes 2 and 3 of the Layer 4 header of the rx packet. r Discard all packets of this flow type. When this option is set, all other options are ignored. flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4 Inserts or updates a classification rule for the specified flow type. ether Ethernet ip4 Raw IPv4 tcp4 TCP over IPv4 udp4 UDP over IPv4 sctp4 SCTP over IPv4 ah4 IPSEC AH over IPv4 esp4 IPSEC ESP over IPv4 For all fields that allow both a value and a mask to be specified, the mask may be specified immediately after the value using the m key- word, or separately using the field name keyword with -mask appended, e.g. src-mask. src xx:yy:zz:aa:bb:cc [m xx:yy:zz:aa:bb:cc] Includes the source MAC address, specified as 6 bytes in hexadecimal separated by colons, along with an optional mask. Valid only for flow-type ether. dst xx:yy:zz:aa:bb:cc [m xx:yy:zz:aa:bb:cc] Includes the destination MAC address, specified as 6 bytes in hexadecimal separated by colons, along with an optional mask. Valid only for flow-type ether. proto N [m N] Includes the Ethernet protocol number (ethertype) and an optional mask. Valid only for flow-type ether. src-ip x.x.x.x [m x.x.x.x] Specify the source IP address of the incoming packet to match along with an optional mask. Valid for all IPv4 based flow-types. dst-ip x.x.x.x [m x.x.x.x] Specify the destination IP address of the incoming packet to match along with an optional mask. Valid for all IPv4 based flow- types. tos N [m N] Specify the value of the Type of Service field in the incoming packet to match along with an optional mask. Applies to all IPv4 based flow-types. l4proto N [m N] Includes the layer 4 protocol number and optional mask. Valid only for flow-type ip4. src-port N [m N] Specify the value of the source port field (applicable to TCP/UDP packets) in the incoming packet to match along with an optional mask. Valid for flow-types ip4, tcp4, udp4, and sctp4. dst-port N [m N] Specify the value of the destination port field (applicable to TCP/UDP packets)in the incoming packet to match along with an option- al mask. Valid for flow-types ip4, tcp4, udp4, and sctp4. spi N [m N] Specify the value of the security parameter index field (applicable to AH/ESP packets)in the incoming packet to match along with an optional mask. Valid for flow-types ip4, ah4, and esp4. l4data N [m N] Specify the value of the first 4 Bytes of Layer 4 in the incoming packet to match along with an optional mask. Valid for ip4 flow- type. vlan-etype N [m N] Includes the VLAN tag Ethertype and an optional mask. vlan N [m N] Includes the VLAN tag and an optional mask. user-def N [m N] Includes 64-bits of user-specific data and an optional mask. dst-mac xx:yy:zz:aa:bb:cc [m xx:yy:zz:aa:bb:cc] Includes the destination MAC address, specified as 6 bytes in hexadecimal separated by colons, along with an optional mask. Valid for all IPv4 based flow-types. action N Specifies the Rx queue to send packets to, or some other action. -1 Drop the matched flow 0 or higher Rx queue to route the flow loc N Specify the location/ID to insert the rule. This will overwrite any rule present in that location and will not go through any of the rule ordering process. delete N Deletes the RX classification rule with the given ID. -w --get-dump Retrieves and prints firmware dump for the specified network device. By default, it prints out the dump flag, version and length of the dump data. When data is indicated, then ethtool fetches the dump data and directs it to a file. -W --set-dump Sets the dump flag for the device. -T --show-time-stamping Show the device's time stamping capabilities and associated PTP hardware clock. -x --show-rxfh-indir Retrieves the receive flow hash indirection table. -X --set-rxfh-indir Configures the receive flow hash indirection table. equal N Sets the receive flow hash indirection table to spread flows evenly between the first N receive queues. weight W0 W1 ... Sets the receive flow hash indirection table to spread flows between receive queues according to the given weights. The sum of the weights must be non-zero and must not exceed the size of the indirection table. -f --flash Write a firmware image to flash or other non-volatile memory on the device. file Specifies the filename of the firmware image. The firmware must first be installed in one of the directories where the kernel firmware loader or firmware agent will look, such as /lib/firmware. N If the device stores multiple firmware images in separate regions of non-volatile memory, this parameter may be used to specify which region is to be written. The default is 0, requesting that all regions are written. All other values are driver-dependent. -l --show-channels Queries the specified network device for the numbers of channels it has. A channel is an IRQ and the set of queues that can trigger that IRQ. -L --set-channels Changes the numbers of channels of the specified network device. rx N Changes the number of channels with only receive queues. tx N Changes the number of channels with only transmit queues. other N Changes the number of channels used only for other purposes e.g. link interrupts or SR-IOV co-ordination. combined N Changes the number of multi-purpose channels. -m --dump-module-eeprom --module-info Retrieves and if possible decodes the EEPROM from plugin modules, e.g SFP+, QSFP. If the driver and module support it, the optical diagnostic information is also read and decoded. --show-priv-flags Queries the specified network device for its private flags. The names and meanings of private flags (if any) are defined by each network device driver. --set-priv-flags Sets the device's private flags as specified. flag on|off Sets the state of the named private flag. --show-eee Queries the specified network device for its support of Energy-Efficient Ethernet (according to the IEEE 802.3az specifications) --set-eee Sets the device EEE behaviour. eee on|off Enables/disables the device support of EEE. tx-lpi on|off Determines whether the device should assert its Tx LPI. advertise N Sets the speeds for which the device should advertise EEE capabiliities. Values are as for --change advertise tx-timer N Sets the amount of time the device should stay in idle mode prior to asserting its Tx LPI (in microseconds). This has meaning only when Tx LPI is enabled. BUGS
Not supported (in part or whole) on all network drivers. AUTHOR
ethtool was written by David Miller. Modifications by Jeff Garzik, Tim Hockin, Jakub Jelinek, Andre Majorel, Eli Kupermann, Scott Feldman, Andi Kleen, Alexander Duyck, Sucheta Chakraborty. AVAILABILITY
ethtool is available from <http://www.kernel.org/pub/software/network/ethtool/> Ethtool version 3.8 December 2012 ETHTOOL(8)
All times are GMT -4. The time now is 08:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy