02-16-2009
I do.. Actually the file has 777 permissions. Is by any chance awk vs nawk making the difference ?
Quote:
Originally Posted by
danmauer
make sure you have execute premissions on the file.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
Can somebody please help me know how do i match the basename using a regular expression using posix standard in shell script
suppose i want to match
/u01/Sybase/data/master.dbf the result should be master.dbf as i want to match everything after the last /
regards (8 Replies)
Discussion started by: xiamin
8 Replies
2. UNIX for Advanced & Expert Users
What do you think of this regex to match IP address? I have been reading up on regex and have seen some really long ones for IP. Would this fail in any scenarios?
(+\.){3}* (5 Replies)
Discussion started by: glev2005
5 Replies
3. UNIX for Dummies Questions & Answers
Hello, can someone help me how to find a word and 2 lines after it and then send the output to another file.
For example, here is myfile1.txt. I want to search for "Error" and 2 lines below it and send it to myfile2.txt
I tried with grep -A but it's not supported on my system.
I tried with awk,... (4 Replies)
Discussion started by: eurouno
4 Replies
4. Shell Programming and Scripting
Using these strings as an example:
<a onclick="doShowCHys=1;ShowWindowN(0,'/daman/man.php?asv4=145148&playTogether=True',960,540,943437);return false;" title="">
<a onclick="doShowCHys=1;ShowWindowN(0,'/daman/man.php?asv4=1451486&playTogether=True',960,540,94343);return false;" title="">
<a... (12 Replies)
Discussion started by: metallica1973
12 Replies
5. Shell Programming and Scripting
Hi
We have a tool to monitor logs in our environment. The tool accepts log pattern match only using regex and I accept I am a n00b in that:confused:. I had been banging my head to make it work without much success and at last had to turn on to my last option to post it here. I had got great... (2 Replies)
Discussion started by: radioactive9
2 Replies
6. Shell Programming and Scripting
Hi All,
I want to print all the occurrences for a particular pattern from a file. The catch is that the pattern search is partial and if any word in the file contains the pattern, that complete word has to be printed. If there are multiple words matching the pattern on a specific line, then all... (2 Replies)
Discussion started by: decci_7
2 Replies
7. UNIX for Advanced & Expert Users
I have a line that I need to parse through and extract a pattern that occurs multiple times in it.
Example line:
getInfoCall: info received please proceed, getInfoCall: info received please proceed, getInfoCall: info received please proceed, getInfoCall: info received please proceed,... (4 Replies)
Discussion started by: Vidhyaprakash
4 Replies
8. Shell Programming and Scripting
The below bash connects to a site, downloads a file, searches that file based of user input - could be multiple (all that seems to work). What I am not able to figure out is how to display on the screen match found or no match found" and write a file to a directory (C:\Users\cmccabe\Desktop\wget)... (4 Replies)
Discussion started by: cmccabe
4 Replies
9. Shell Programming and Scripting
I'm trying to get some exclusions into our sendmail regular expression for the K command. The following configuration & regex works:
LOCAL_CONFIG
#
Kcheckaddress regex -a@MATCH
+<@+?\.++?\.(us|info|to|br|bid|cn|ru)
LOCAL_RULESETS
SLocal_check_mail
# check address against various regex... (0 Replies)
Discussion started by: RobbieTheK
0 Replies
10. Shell Programming and Scripting
Hello Friends,
Can somebody assist an issue I am having? I have a separate file with a list of account ids
XXX200B02Y01
XXX200B03Y01
XXX200B05Y01
XXX200B07Y01
XXX200B08Y01
I call the file, and run an egrep against a directory and logfiles
AccountID=$(cat... (2 Replies)
Discussion started by: liketheshell
2 Replies
LEARN ABOUT DEBIAN
tie::hash::regex
Tie::Hash::Regex(3pm) User Contributed Perl Documentation Tie::Hash::Regex(3pm)
NAME
Tie::Hash::Regex - Match hash keys using Regular Expressions
SYNOPSIS
use Tie::Hash::Regex;
my %h;
tie %h, 'Tie::Hash::Regex';
$h{key} = 'value';
$h{key2} = 'another value';
$h{stuff} = 'something else';
print $h{key}; # prints 'value'
print $h{2}; # prints 'another value'
print $h{'^s'}; # prints 'something else'
print tied(%h)->FETCH(k); # prints 'value' and 'another value'
delete $h{k}; # deletes $h{key} and $h{key2};
or (new! improved!)
my $h : Regex;
DESCRIPTION
Someone asked on Perlmonks if a hash could do fuzzy matches on keys - this is the result.
If there's no exact match on the key that you pass to the hash, then the key is treated as a regex and the first matching key is returned.
You can force it to leap straight into the regex checking by passing a qr'ed regex into the hash like this:
my $val = $h{qr/key/};
"exists" and "delete" also do regex matching. In the case of "delete" all vlaues matching your regex key will be deleted from the hash.
One slightly strange thing. Obviously if you give a hash a regex key, then it's possible that more than one key will match (consider
c<$h{qw/./}>). It might be nice to be able to do stuff like:
my @vals = $h{$pat};
to get all matching values back. Unfortuately, Perl knows that a given hash key can only ever return one value and so forces scalar context
on the "FETCH" call when using the tied interface. You can get round this using the slightly less readable:
my @vals = tied(%h)->FETCH($pat);
ATTRIBUTE INTERFACE
From version 0.06, you can use attributes to define your hash as being tied to Tie::Hash::Regex. You'll need to install the module
Attribute::Handlers.
METHODS
FETCH
Get a value from the hash. If there isn't an exact match try a regex match.
EXISTS
See if a key exists in the hash. If there isn't an exact match try a regex match.
DELETE
Delete a key from the hash. If there isn't an exact match try a regex match.
AUTHOR
Dave Cross <dave@mag-sol.com>
Thanks to the Perlmonks <http://www.perlmonks.org> for the original idea and to Jeff "japhy" Pinyan for some useful code suggestions.
COPYRIGHT
Copyright (C) 2001-8, Magnum Solutions Ltd. All Rights Reserved.
LICENSE
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
perl(1).
perltie(1).
Tie::RegexpHash(1)
perl v5.10.0 2008-06-30 Tie::Hash::Regex(3pm)