Sponsored Content
Top Forums Shell Programming and Scripting awk : match only the pattern string , not letters or numbers after that. Post 302813595 by Yoda on Monday 27th of May 2013 04:48:48 PM
Old 05-27-2013
Code:
awk -F'=' -v L="lan3" '{v=$2;gsub(/"/,X,v)}v=="lan3"' file

This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

match numbers (awk)

i would like to enter (user input) a bunch of numbers seperated by space: 10 15 20 25 and use awk to print out any lines in a file that have matching numbers so output is: 22 44 66 55 (10) 77 (20) (numbers 10 and 20 matched for example) is this possible in awk . im using gawk for... (5 Replies)
Discussion started by: tanku
5 Replies

2. UNIX for Advanced & Expert Users

how can awk match multi pattern in a string

Hi all, I need to category the processes in my system with awk. And for now, there are several command with similar name, so i have to match more than one pattern to pick it out. for instance: binrundb the string1, 2 & 3 may contain word, number, blank or "/". The "bin" should be ahead "rundb"... (5 Replies)
Discussion started by: sleepy_11
5 Replies

3. Shell Programming and Scripting

AWK break string into fields + pattern match

I am trying to break a string into separate fields and print the field that matches a pattern. I am using awk at the moment and have gotten this far: awk '{for(i=1;i<=NF;++i)print "\t" $i}' longstring This breaks the string into fields and prints each field on a separate line. I want to add... (2 Replies)
Discussion started by: Moxy
2 Replies

4. Shell Programming and Scripting

AWK match $1 $2 pattern in file 1 to $1 $2 pattern in file2

Hi, I have 2 files that I have modified to basically match each other, however I want to determine what (if any) line in file 1 does not exist in file 2. I need to match column $1 and $2 as a single string in file1 to $1 and $2 in file2 as these two columns create a match. I'm stuck in an AWK... (9 Replies)
Discussion started by: right_coaster
9 Replies

5. UNIX for Dummies Questions & Answers

Awk pattern with letters and forward slash

Hi, I have a tab delimited file "test.txt" like this: id1 342 C/T id2 7453 T/A/-/G/C id3 531 T/C id4 756 A/T/G id5 23 A/G id6 717 T/A/C id7 718 C/T/A And so on, with the possible choices for letters being A,C,T,G. I would like to exclude from my file all the lines that do not have... (3 Replies)
Discussion started by: francy.casa
3 Replies

6. UNIX for Dummies Questions & Answers

Selective Replacements: Using sed or awk to replace letters with numbers in a very specific way

Hello all. I am a beginner UNIX user who is using UNIX to work on a bioinformatics project for my university. I have a bit of a complicated issue in trying to use sed (or awk) to "find and replace" bases (letters) in a genetics data spreadsheet (converted to a text file, can be either... (3 Replies)
Discussion started by: Mince
3 Replies

7. Shell Programming and Scripting

Awk to match a pattern and perform a search after the first pattern

Hello Guyz I have been following this forum for a while and the solutions provided are super useful. I currently have a scenario where i need to search for a pattern and start searching by keeping the first pattern as a baseline ABC DEF LMN EFG HIJ LMN OPQ In the above text i need to... (8 Replies)
Discussion started by: RickCharles
8 Replies

8. Shell Programming and Scripting

Match pattern and get lines numbers in a vector

Hi everyone, I am new to shell scripting, and would appreciate your help on following problem. I need to search a file for a pattern, then get the number of each line that matches the given pattern. Then I need to search those specific line numbers from the first file in a second file and... (6 Replies)
Discussion started by: dimcick
6 Replies

9. UNIX for Dummies Questions & Answers

Determine if first 2 digits of string match numbers

Trying to find out how to discover if the first 2 characters of a string are "22" Not sure how. I could use if ]; then echo "yes";fi But I think that will only grab the pattern 22 and not the first 2 digits. (5 Replies)
Discussion started by: newbie2010
5 Replies

10. UNIX for Beginners Questions & Answers

Decimal numbers and letters in the same collums: round numbers

Hi! I found and then adapt the code for my pipeline... awk -F"," -vOFS="," '{printf "%0.2f %0.f\n",$2,$4}' xxx > yyy I add -F"," -vOFS="," (for input and output as csv file) and I change the columns and the number of decimal... It works but I have also some problems... here my columns ... (7 Replies)
Discussion started by: echo manolis
7 Replies
ndp(1M) 																   ndp(1M)

NAME
ndp - IPv6 Neighbor Discovery cache display and control SYNOPSIS
host interface] interface] interval interface] host interface] interface] interface] interface host hw_addr filename DESCRIPTION
The command displays and modifies the IPv6 Neighbor Discovery cache as specified in the IPv6 Neighbor Discovery (ND) protocol. Options recognizes the following options and arguments: host Display the current Neighbor Discovery cache entries for the host specified by host, which is either a name present in the hostname database (see hosts(4)), or an IPv6 address expressed in colon notation (see inet6(3N)). Select the Neighbor Discovery cache entries for the specified interface. There is no distinction between primary and secondary interfaces. Therefore, specifying is the same as speci- fying Display host addresses in IPv6 colon notation. If this option is not specified, attempts to display host addresses symbolically first, and falls back to displaying the host addresses in IPv6 colon notation if that failed. Display all Neighbor Discovery cache entries. Continuously display all Neighbor Discovery cache entries, updated at each interval, measured in seconds. Deletes Neighbor Discovery cache entries with IP addresses that are not associated with local interfaces for the host specified by host. Flushes all Neighbor Discovery cache entries with IP addresses that are not associated with local interfaces. These are entries with the (local) flag set. Refer to the section of this manpage for information about flags. (Quiet) Do not write anything to standard output. This option only applies to and options. Display the prefix list in the Neighbor Discovery cache table. The prefix list defines a set of IP address ranges that the host can reach. The prefix flags are for on-link, and for au- tonomous. The on-link flag indicates that addresses with that prefix can be reached directly without going through a router. The autonomous flag indicates that the prefix came from stateless autoconfiguration. Flushes all autoconfigured addresses learned from prefixes advertised by the Router Advertisement Messages. Create a Neighbor Discovery cache entry for the interface specified by interface, the host specified by host, and the hardware address (link-layer address) specified by hw_addr. The hw_addr is specified as where each x is a hexadecimal digit. If is specified, the entry is published, which means that this system will respond to Neighbor Solicitation for the speci- fied "host" even though the host address is not its own. If is specified, it means that the published entry refers to an anycast address. This parameter can only be specified when the parameter is specified. Create Neighbor Discovery cache entries from the specifications found in the file specified by filename. Each entry in this file specifies the interface, host, hw_addr, and optionally the flag. For example, the content of this file can be: The use of and options requires root privileges. Contents A Neighbor Discovery cache entry includes the following fields: o host (neighbor's host name or IP address) o hardware address (link layer address) of host o interface name o state o flags The state of an entry can be or o An entry is in an state if address resolution is in progress and the hardware address of the neighbor has not been determined. o An entry is in a state if the neighbor is known to have been reachable recently. o An entry is in a state if the neighbor is no longer known to be reachable. However, no attempt has been made to verify its reachability because no traffic has been sent to this neighbor. o An entry is in a state if the neighbor is no longer known to be reachable, and traffic has recently been sent to the neighbor. o An entry is in a state if the neighbor is no longer known to be reachable, and unicast Neighbor Solicitation probes have been sent to verify reachability. The flags can be (Deprecated), (Local), (Published), (Temporary), (Auto), or (anycast). A deprecated address can be used for receiving packets, but it should not be used for sending packets because its validity is expected to expire soon. The local flag indicates that this Neighbor Discovery cache entry corresponds to an interface on this host. The published flag indicates that the host will respond to Neigh- bor Solicitations on this IPv6 address. The temporary flag indicates that the address has a randomly generated interface identifier which changes over time. The autonomous flag indicates that the prefix for the address came from stateless address autoconfiguration. The any- cast flag indicates that the address is an anycast address. DIAGNOSTICS
returns a non-zero value to indicate errors. A zero return value indicates success. EXAMPLES
The following output shows the local interfaces and the IP addresses assigned to them. Name Mtu Address/Prefix Ipkts Opkts lan1 1500 fe80::210:83ff:fef7:3a21/10 982 759 lan1:1 1500 fec0::9:210:83ff:fef7:3a21/64 0 0 lan3 1500 fe80::210:83ff:fef7:7a9d/10 0 0 lo0 4136 ::1/128 57 57 To display the entire Neighbor Discovery cache: Destination Physical Address Interface State Flags fe80::202:fdff:fe36:8720 0:2:fd:36:87:20 lan1 STALE - fec0::9:210:83ff:fef7:3a21 0:10:83:f7:3a:21 lan1:1 REACHABLE LP fe80::210:83ff:fef7:3a21 0:10:83:f7:3a:21 lan1 REACHABLE LP fe80::210:83ff:fef7:7a9d 0:10:83:f7:7a:9d lan3 REACHABLE LP To show Neighbor Discovery cache entries for a host: Destination Physical Address Interface State Flags fe80::210:83ff:fef7:3a21 0:10:83:f7:3a:21 lan1 REACHABLE LP To show Neighbor Discovery cache entries for an interface: Destination Physical Address Interface State Flags fe80::210:83ff:fef7:7a9d 0:10:83:f7:7a:9d lan3 REACHABLE LP To delete a Neighbor Discovery cache entries for a host and an interface: fe80::202:fdff:fe36:8720 (fe80::202:fdff:fe36:8720) deleted. To show the prefix list: Prefix List Interface Valid Preferred Flags Entries Lifetime Lifetime fec0:0:0:9::/64 lan1 167 107 A fe80::/10 lan1 inf inf LA fe80::/10 lan3 inf inf LA To add an entry in the Neighbor Discovery cache: nodeb (2001::1) added. Destination Physical Address Interface State Flags fe80::210:83ff:fef7:7a9d 0:10:83:f7:7a:9d lan3 REACHABLE LP 2001::1 0:1:2:3:4:5 lan3 - - To flush all remote entries: nodea (fe80::202:fdff:fe36:8720) flushed. nodeb (2001::1) flushed. AUTHOR
was developed by HP. SEE ALSO
hosts(4), inet6(3N), ndp(7P). Neighbor Discovery for IP Version 6 (IPv6), RFC2461, Narten, Nordmark, Simpson. IPv6 Stateless Address Autoconfiguration, RFC2462, Thomson, Narten. ndp(1M)
All times are GMT -4. The time now is 07:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy