Programming :: Awk Computed Regex Not Working As Expected

May 31, 2011

So those of you that know me will agree that when it comes to awk I don't usually ask a lot of questions ... however this one has me stumped. I am guessing I have missed something obvious but for the life of me (and I have tested at great length) I cannot find it So the scenario is this: The following awk code should identify all versions of libgpg-error within the attached file (see below) and only show one for each version:


View 12 Replies


Programming :: Regex To Read An Ip?

May 14, 2011

I need a regex expression to read IP address from lines like these for my perl script:

2011.05.13-14:54:58,,, pop3
2011.05.13-14:57:26,,, pop3
2011.05.13-14:57:54,,, imap
2011.05.13-14:57:55,,, imap
2011.05.13-15:03:08,,, pop3

View 6 Replies View Related

Programming :: ! For Not Matching Bash Regex?

Jan 13, 2011

In a bash-script, only the case if a regular expression does not match is relevant.herefore I used the exclamation mark !. But where to place it?

These two work fine, but are they equivalent?
Code: if ! [[ $abc =~ $pattern ]]; then or
Code: if [[ ! $abc =~ $pattern ]]; then Where is the ! placed more correct?

View 2 Replies View Related

Programming :: Program To Use Grep W/regex?

Jun 1, 2011

I'm just starting out with bash scripting (yesterday, really). I want to add a file to each user's home directory, pretty simple really, and send it out via our Apple Remote Desktop system to our Macs. Here is my script: Code: #!/bin/bash

for i in $(ls -d /Users/*)
doif [ -e $i/.tcshrc ]
thenecho "$i/.tcshrc exists!"elseecho "$i/.tcshrc does not exist"


View 6 Replies View Related

Programming :: Find With A Regex Path?

May 5, 2010

I'm using bash scripting to find any file that matches a path governed by the following regular expression:

to match files like:

I've tried:

find ./ -regextype posix-egrep -regex $myRegex

and it just spins and never gives me an answer, even though the file structure isn't that big.

View 8 Replies View Related

OpenSUSE :: Use Of Setfacl Not Working As Expected

Jun 4, 2010

I used setfacl to set permissions as follows:

As you can see all settings lead to permissions 777 but that's not what happens. What happens if I say, touch a file, I get: 666 as this shows:

Same for files that are not obviously scripts such as just a.txt.

My umask is 0022.

Does anyone know why this is? Is it changeable for specific directories?

This is a special world viewed directory required by a piece of software... in other words, no, I am not in a habit of setting file permissions to 777 so please no comments about you shouldn't be using such permissions.

Truthfully, I can probably get away with permissions 666 and will if I can but right now I just want to know why it's happening this way and how to control it.

View 4 Replies View Related

Red Hat / Fedora :: DST Change Over Not Working As Expected

Mar 24, 2010

I'm trying to test whether some software that I am using will behave as expected when DST change over occurs. I'm specifically testing it for the GB timezone when it enters British Summer Time (BST) and then reverts to GMT. From the information I have, BST starts: Sunday 28 March 01:00 GMT (02:00 BST)and ends: Sunday 31 October 02:00 BST (01:00 GMT )To do this test I wrote a shell script that sets the date, runs the program, checks some logs and then reverts the time.

Entering BST was fairly straight forward as all I had to do was the following: export TZ=GB
date 032800582010This set the date to be 28th March and the time to be 00:58 in the GB (GMT) timezone. As expected, the date then rolled forward to 02:00 BST. However, when I tried to do the same for coming out of BST into GMT, the time did not work out as expected. export TZ=GB
date 103101582010Setting the time as above put the time straight into GMT and not BST even though it was two minutes before the time should have rolled-over.

However if I put the following: export TZ=GB
date 103100582010the date was reported as BST!
How can I setup the time so that I don't have to wait for hour before BST ends?

View 2 Replies View Related

Programming :: Bash-REGEX For Validating Computername?

Apr 3, 2011

I'm writing a script to read user input for a computername.I need a check that a given userinput is valid.Right now I use grep like this (for sure not optimal):Quote:

if echo "$name" | grep -q '[^a-z][^A-Z][^0-9]'; then
echo error


View 12 Replies View Related

Programming :: BASH - Regex In A Case Statement?

Jun 9, 2010

the following works and BASH doesn't complain, but VIM highlights the closing square bracket is if it sees a syntax error. Is there a better way to express regex in a case statement or is this an issue with VIM?

case $1 in


View 3 Replies View Related

Programming :: Bash Regex String Extraction?

Jun 10, 2011

g echo ${mm[$j]}
4 BashNotes


View 2 Replies View Related

Programming :: Specific Regex Pattern In Perl?

Feb 23, 2011

I'm fairly new to Perl and regular expressions. I have a large collection of files with their file names in the following general format: string - another string with spaces (2004) [year].ext I would like to know how I could create a regex to separate out:

the first string
another string with spaces

If you know of a better way of doing it without regular expressions, I would be happy to hear that way too.

View 13 Replies View Related

Programming :: Perl Regex Matching HTML?

Mar 19, 2010

I'm trying to find out how to extract the string between the 2 <title> tags: <title>this is what i want</title>.I found lots of results but nothing I've tried works.. EG:$page =~ m/<title>($.)</title>/gism;

View 2 Replies View Related

Programming :: Insert A Variable Into A Regex In Perl?

Jan 17, 2010

I was wondering if you insert a variable into a regex in Perl, will the contents of the variable be expanded by the regex engine?

View 14 Replies View Related

Programming :: Perl - Regex With Array Elements?

Mar 13, 2011

I have .txt.gz files that store queries made on a browser, d my job is to analyze them.The information is stored in a xml-like style.Quote:

<keywords />


View 6 Replies View Related

General :: Locale Adjustment Not Working As Expected?

May 13, 2011

On Slackware64 13.1 the as-installed en_GB locale gave Sunday as the first day of the week. This was not an issue until Xfce's Orage calendar was used when its display of Sunday as the first day of the week was offputting for someone used to Monday. A minor inconvenience but expected to be easy to fix.

At the command line:
c@CW8:~$ export LANG=en_GB <== same for en_GB.utf8


View 2 Replies View Related

Networking :: Cannot Login Using Ssh (iptables Not Working As Expected)

Jun 20, 2010

On the computer on which I have to login, Shoreline is installed.I know I can add rule to /etc/shoreline/rules but I decided to manually enter an iptable rule by typing:


/sbin/iptables -A local2fw -s -p tcp -m tcp --dport 22 -j ACCEPT

Then why am I not able to login using I get connection refused error...

View 3 Replies View Related

Security :: SSH Login Without Password Not Working As Expected?

May 5, 2010

There is this one server running CentOS5.4 Final which has certain application like Bugzilla. I have setup ssh on it and setup is for password less authentication. Have also setup PasswordAuthentication to no. So with password authentication should succeed. But it is. Though password less authentication is working fine, but I am also able to login using password.


RSAAuthentication yes
PubkeyAuthentication yes
PermitEmptyPasswords no
PasswordAuthentication no

View 4 Replies View Related

CentOS 5 Server :: Openldap Acl Not Working As Expected?

Jun 22, 2009

CentOS 5.2. Openldap server-2.3.27-8.el5_2.4 I'm trying to get the server to do two things. One is allow authentication--that is, if a client is configured to use openldap for authentication, it should be able to access this server.

In other words, on machine_2, a client, doing getent passwd (as a quick test) will show the users in the openldap database. The more or less out of the box configuration works for this. However, as soon as I start trying to add ACLs, it stops working. For example, I want to restrict access to an address book which is also in the database. So I have

access to base.dn(changing base to subtree makes no difference) "ou=addressbook,dc=example, dc=com"
by users read by anonymous auth Now, even though this is just the address book, after that, an ldap client can no longer get the names of users in ou=People, and using the ldap server for authentication doesn't work.

I don't understand what I'm missing. ACLs are supposed to work first match wins. *IF* I add under that, access to * by * read, it will work, but the address book can then be accessed without a bind dn.

I am not sure what I'm overlooking. If I put in any sort of access control, the only way that clients can continue to use the server for authentication is adding that access to * (or to dc=example,dc=com"), by * read. I tried using access to ou=Group and ou=Peoplle by * read, thinking that would allow the clients to authenticate, but that doesn't work either, The idea is to allow any machine configured as a client to use it for authentication, but also to restrict viewing the address book only to those with a proper bind dn name.

View 4 Replies View Related

Programming :: C Code Not Running As Expected / Cause Of It?

Apr 27, 2010

I was wondering why this code only returns me the same value ten times instead of valuate the conta+0.1 value code...

View 6 Replies View Related

Programming :: Include A String Variable In A Regex (Perl)

Jan 9, 2010

how do you include a string variable as part of a regex in Perl?

View 5 Replies View Related

Programming :: If Statement Regex Match For White Spaces?

Apr 8, 2011

I want to match for this string:



Both lines are new lines, so they won't be inline. Other than that, they are all constants, I want this regex match to be an if statement rather than returning match string. so if the $content variable contains some string that matches:


if `sed "//p"` ;

View 4 Replies View Related

Programming :: Unable To Extract Java Regex For Links

Mar 22, 2011

Im trying to extract the href of a <link> tag from a html page however as some links contain further preferences I seem to be unable to extract them, do you have any idea how I can write this: Link:


View 9 Replies View Related

Programming :: Find A Proper Regex To Match The Two Numbers?

Nov 10, 2010

am trying to find a proper regex to match the two numbers in the following log entry.

15:08:16.142 INF Found 64468
15:08:16.142 ERR [Uniform test code=64469]

Basically the pattern I'm looking for will match the two different numbers spanned across two lines.Thought I need to use multi-line mode as follow but this doesn't match on [URL]...


View 6 Replies View Related

Programming :: Use Perl Regex To Extract The Hostname From A FQDN?

Nov 19, 2010

How do i use perl regex to extract the hostname from a FQDN?

I have



i just want the characters which are to the left of the first .(dot) in FQDN name. I could get it using substr and split function,but how do i get it through regex.

View 13 Replies View Related

Programming :: Sed Regex Get Multiple String Match In Array?

Apr 8, 2011

I have a sed match that matches for certain string of a regex expression:

tname=$(echo "$contents" | sed -n 'some pattern')

How do I match for multiple strings in the $contents and return them as an array? for example

contents="this is a text, just to match patterns, here is another text to be matched"
the sed func would be able to recognize both "text"s, but only one is outputted?

Possible to put it in an array? so ${bar[0]} gives one and ${bar[1]} gives another

View 3 Replies View Related

Ubuntu :: Folder View Screenlet Not Working As Expected?

Mar 4, 2010

I want to try out the screenlet called Folder View:[URL]I have downloaded and installed it fine. However, when I double-click on it (or use the Start/Stop button) there is a momentary flash and then nothing interesting. I have checked on the widget layer and on all desktops and I have tried various settings in Options all to no avail

View 2 Replies View Related

Ubuntu Servers :: Postfix+dovecot Not Working As Expected?

Nov 9, 2010

I have tried to find solution in existing posts but could not specifically find any with my kind of issues and hence a new post on oft repeated subject !! -- and apologies for a long long post here.Here is where I am ..On a AMD 64bit machine - I have ubuntu 10.10 desktop installed. I want this development machine to support virtual mailboxes so that I can use them from multiple apps and create real life deployment situations.I installed postfix + dovecot following the tutorials available here and current state is - I can send mails using telnet sessions and I see that the mail files are getting created in /Maildir form as I have directed in the conf files. I have configured Thunderbird mail client as well.

Issue #1: Mail sending works from Thunderbird but it always responds back with 'No mail on server' message when I try to receive mails. SMTP is configured with STARTTLS and POP3 with None (i.e. plain text password)Issue #2: Also, while going thru conf, logs and during testing - I found a few things which defer in this installation for authentication. I have given the session transcripts here.Issue #3: That being major issue - I also want to configure my virtual users to use TB client to access their mails - I did not find any tutorials or pointers towards that in my search for past few days. If I send mails to a non-Unix virtual user - the mail gets stored into /home/vmail/<domain>/<user>/new directory.Here are the conf for postfix

# See /usr/share/postfix/ for a commented, more complete version
# Debian specific: Specifying a file name will cause the first


View 1 Replies View Related

General :: Bulk File Rename Not Working As Expected?

Jun 25, 2011

Y want to rename a bunch of files and directories to remove the space on the names, easy enough right?

for source in $(find ./); do target=$(echo "$source"|sed -e 's/ /_/g'); mv -f "$source" $target; done

Well, I thought that should have work but the problem is that $source comes up broken, when I run it with echo instead of mv I get the echo with broken names.

In this case "$source"="This is the file I want to rename"
$ echo "$source"


View 3 Replies View Related

Ubuntu :: Rsyslog Upstart Script Not Working As Expected?

Mar 13, 2011

Not sure if this is the correct area to ask this question as it pertains to Upstart but not necessarily to Ubuntu.

Anyhoo, I have made a small alteration (obviously the cause of error ) but not really sure why it does not work.

# rsyslog - system logging daemon
# rsyslog is an enhanced multi-threaded replacement for the traditional
# syslog daemon, logging messages from applications


View 3 Replies View Related

Programming :: Why The Expected =, ,, ;, Asm Or __attribute__ Before Typedef Error

Feb 2, 2010

Can you tell me why gcc on LINUX is giving me this error (works find on our SCO machine)/us4/prw/include/vv_sys.h:797: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'

797 typedef struct node_struct /*NODE STRUCTURE */
798 {
799 struct node_struct *prev_ndp; /*previous node pointer */


View 8 Replies View Related

Copyrights 2005-15, All rights reserved