Sponsored Content
Top Forums Shell Programming and Scripting How to make working this regex in perl? Post 302927386 by Scrutinizer on Tuesday 2nd of December 2014 02:54:38 PM
Old 12-02-2014
The error message is what it says. The lookbehind can not be of variable length. That means in this case that the use of alternation (|) in (?<=^|RR45) is not allowed because the two sides (^ and RR45) are not the same length..

Last edited by Scrutinizer; 12-02-2014 at 04:08 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

gnu sed regex grouping not working?

Hello, from the gnu sed manual, I should be able to do this: `\(REGEXP\)' Groups the inner REGEXP as a whole, this is used to: * Apply postfix operators, like `\(abcd\)*': this will search for zero or more whole sequences of `abcd', while `abcd*' ... (3 Replies)
Discussion started by: Allasso
3 Replies

2. Shell Programming and Scripting

BASH regex (convert from working perl version)

Hi there, I need to test that a variable ($VAR) matches a regex mask in BASH. I have the exact thing working in perl (below), but could somebody advise me how i would do the same in BASH ? do i need to use something like egrep ? #!/bin/perl -w my $VAR = "some value"; if ( $VAR =~... (4 Replies)
Discussion started by: rethink
4 Replies

3. Shell Programming and Scripting

bash with: if, elif & regex not working

Why is only hello3 being printed? There must be some kind of syntax problem because the file list definitely includes all the file extensions line by line. #!/bin/bash find '/home/myuser/folder/' -name '*.c' -type f | while read F do if ] # if the file name ends in .txt.c then ... (6 Replies)
Discussion started by: cyler
6 Replies

4. Shell Programming and Scripting

Converting perl regex to sed regex

I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly: if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies

5. Shell Programming and Scripting

matching a regex using egrep not working

Hi, I'm trying to validate if a string matches a regular expression, but it is not working. Am I missing something? Do I need to scape any of the characters? if echo 'en-GB' | egrep '({1,8})(-{1,8})*' >/dev/null; then echo Valid value fi Thanks in advance (6 Replies)
Discussion started by: skrtxao
6 Replies

6. Shell Programming and Scripting

need to grep contents of a file within specific time span. regex i am using is not working

Hi , I am trying to extract contents of a file between specified time stamp. but it does not seem to work. i am trying to extract output of /var/adm/messages between 15:00:00 to 15:23:59 . i have tried two regex the first one seems to kind of work. it displays some output. the second one is... (13 Replies)
Discussion started by: chidori
13 Replies

7. UNIX for Dummies Questions & Answers

Gsub regex not working

I have a number of files that I pass through awk/gsub. I believe to have found a working regex and on 'test bed' sites it matches, however within gsub it does not. Examples: Initial data: /Volumes/Daniel/Public/Drop Box/_Hellsing_Ultimate_OVA_-_10_.mkv gsub & regex: gsub("\]+\]","" ... (4 Replies)
Discussion started by: unknownn
4 Replies

8. Shell Programming and Scripting

If statement with [[ ]] and regex not working as expected

Using BASH: $ if -- ::00" ]]; then echo "true"; else echo "false"; fi false Mike (5 Replies)
Discussion started by: Michael Stora
5 Replies

9. Shell Programming and Scripting

Regex not working

I am using a regex to exactly match a string abcdef as ^abcdef$. But it does'nt seem to work :( (11 Replies)
Discussion started by: gaurav99
11 Replies

10. Shell Programming and Scripting

Perl, RegEx - Help me to understand the regex!

I am not a big expert in regex and have just little understanding of that language. Could you help me to understand the regular Perl expression: ^(?!if\b|else\b|while\b|)(?:+?\s+){1,6}(+\s*)\(*\) *?(?:^*;?+){0,10}\{ ------ This is regex to select functions from a C/C++ source and defined in... (2 Replies)
Discussion started by: alex_5161
2 Replies
libnetlink(3)						     Library Functions Manual						     libnetlink(3)

NAME
libnetlink - A library for accessing the netlink service SYNOPSIS
#include <asm/types.h> #include <libnetlink.h> #include <linux/netlink.h> #include <linux/rtnetlink.h> int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions) int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) int rtnl_send(struct rtnl_handle *rth, char *buf, int len) int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len) int rtnl_dump_filter(struct rtnl_handle *rth, int (*filter)(struct sockaddr_nl *, struct nlmsghdr *n, void *), void *arg1, int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *), void *arg2) int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, unsigned groups, struct nlmsghdr *answer, int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *), void *jarg) int rtnl_listen(struct rtnl_handle *rtnl, int (*handler)(struct sockaddr_nl *,struct nlmsghdr *n, void *), void *jarg) int rtnl_from_file(FILE *rtnl, int (*handler)(struct sockaddr_nl *,struct nlmsghdr *n, void *), void *jarg) int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data) int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen) int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data) int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen) DESCRIPTION
libnetlink provides a higher level interface to rtnetlink(7). The read functions return 0 on success and a negative errno on failure. The send functions return the amount of data sent, or -1 on error. rtnl_open Open a rtnetlink socket and save the state into the rth handle. This handle is passed to all subsequent calls. subscriptions is a bitmap of the rtnetlink multicast groups the socket will be a member of. rtnl_wilddump_request Request a full dump of the type database for family addresses. type is a rtnetlink message type. rtnl_dump_request Request a full dump of the type data buffer into buf with maximum length of len. type is a rtnetlink message type. rtnl_dump_filter Receive netlink data after a request and filter it. The filter callback checks if the received message is wanted. It gets the source address of the message, the message itself and arg1 as arguments. 0 as return means that the filter passed, a negative value is returned by rtnl_dump_filter in case of error. NULL for filter means to not use a filter. junk is used to filter messages not destined to the local socket. Only one message bundle is received. Unless there is no message pending, this function does not block. rtnl_listen Receive netlink data after a request and pass it to handler. handler is a callback that gets the message source address, the mes- sage itself, and the jarg cookie as arguments. It will get called for all received messages. Only one message bundle is received. Unless there is no message pending this function does not block. rtnl_from_file Works like rtnl_listen, but reads a netlink message bundle from the file file and passes the messages to handler for parsing. The file contains raw data as received from a rtnetlink socket. The following functions are useful to construct custom rtnetlink messages. For simple database dumping with filtering it is better to use the higher level functions above. See rtnetlink(3) and netlink(3) on how to generate a rtnetlink message. The following utility functions require a continuous buffer that already contains a netlink message header and a rtnetlink request. rtnl_send Send the rtnetlink message in buf of length len to handle rth. addattr32 Add a __u32 attribute of type type and with value data to netlink message n, which is part of a buffer of length maxlen. addattr_l Add a variable length attribute of type type and with value data and alen length to netlink message n, which is part of a buffer of length maxlen. data is copied. rta_addattr32 Initialize the rtnetlink attribute rta with a __u32 data value. rta_addattr32 Initialize the rtnetlink attribute rta with a variable length data value. BUGS
The functions sometimes use fprintf and exit when a fatal error occurs. This library should be named librtnetlink. AUTHORS
netlink/rtnetlink was designed and written by Alexey Kuznetsov. Andi Kleen wrote the man page. SEE ALSO
netlink(7), rtnetlink(7) /usr/include/linux/rtnetlink.h libnetlink(3)
All times are GMT -4. The time now is 11:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy