02-21-2012
Grep uses regular expressions and . has a special meaning, it means any character. To look for a . you need to escape it : \.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to write a shell script to transfer the files every hour from source - target server.
The cron job should be running every hour and shouldn't copy already copied files to the remote server ?
I was able to write intial script but not able to get the logic for (in the next run it should... (12 Replies)
Discussion started by: radhirk
12 Replies
2. Shell Programming and Scripting
Hi friends..
I hav a problem....
I dont know how to check .c files exists r not in a folder using IF in C shell script
actually i tried like this
if(=~ *.c)
even though some .c files or there in the current folder..it is not entering int o the if control statement...... (17 Replies)
Discussion started by: p.hemadrireddy
17 Replies
3. Shell Programming and Scripting
I'm new to shell scripting... i have been given a task.. can any one help in this regard....
1) Check hourly for files in <destination-path><destination-file-template><destination-file-suffix> for files older than <destination-file-retention> days and purge. It should then check... (1 Reply)
Discussion started by: satishpabba
1 Replies
4. Shell Programming and Scripting
I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies
5. Shell Programming and Scripting
HI all,
I want to script where all the server names will be in a text file like
server1
server2
server3 . and the script should take servernames from a text file and perform copy of files if the files are not present on those servers.after which it should take next servername till the end of... (0 Replies)
Discussion started by: joseph.dmello
0 Replies
6. Shell Programming and Scripting
Hi All,
Thanks in Advance
I wrote the following code
if
then
echo "version is 1.1"
for i in "subscriber promplan mapping dedicatedaccount faflistSub faflistAcc accumulator pam_account"
do
FILE="SDP_DUMP_$i.csv"
echo "$FILE"
... (5 Replies)
Discussion started by: aealexanderraj
5 Replies
7. Shell Programming and Scripting
hi,
I am having script in which i want to check if directory has any file in it or not. If directory contains a single or more files then and only then it should proceed to further operations...
P.S.: Directory might have thousand number of files. so there might be chance of getting error... (4 Replies)
Discussion started by: VSom007
4 Replies
8. Shell Programming and Scripting
Hi there,
I'm a newbie in unix and am fishing for options related to how raw input data files are handled. The scenario, as I'm sure y'all must be very familiar with, is this : we receive upwards of 50 data files in ASCII format from various source systems - now each file has its own structure... (3 Replies)
Discussion started by: Prat Khos
3 Replies
9. Shell Programming and Scripting
Hi,
I am trying to write a script for following scenario:
I have a list of countries from where I receive files...eg. (Indonesia, Thailand, Australia...etc)
For each country, I have a list of files that they send.
IND -- a,b,c
TH -- p,q,r
AU -- x,y,z
The path for these files could... (2 Replies)
Discussion started by: neil.k
2 Replies
10. Shell Programming and Scripting
Hello,
I needed help with a shell script where in it checks if a file exists under a directory and also checks the age of the file and delete it if it is older than 3 weeks.
thanks (10 Replies)
Discussion started by: hasn318
10 Replies
LEARN ABOUT DEBIAN
perl::critic::policy::regularexpressions::prohibitescapedmetacha
Perl::Critic::Policy::RegularExpressions::ProhibitEscapeUseraContributPerl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters(3pm)
NAME
Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters - Use character classes for literal meta-characters instead of
escapes.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Ever heard of leaning toothpick syndrome? That comes from writing regular expressions that match on characters that are significant in
regular expressions. For example, the expression to match four forward slashes looks like:
m//////;
Well, this policy doesn't solve that problem (write it as "m{////}" instead!) but solves a related one. As seen above, the escapes make
the expression hard to parse visually. One solution is to use character classes. You see, inside of character classes, the only
characters that are special are "", "]", "^" and "-", so you don't need to escape the others. So instead of the following loose IPv4
address matcher:
m/ d+ . d+ . d+ . d+ /x;
You could write:
m/ d+ [.] d+ [.] d+ [.] d+ /x;
which is certainly more readable, if less recognizable prior the publication of Perl Best Practices. (Of course, you should really use
Regexp::Common::net to match IPv4 addresses!)
Specifically, this policy forbids backslashes immediately prior to the following characters:
{ } ( ) . * + ? | #
We make special exception for "$" because "/[$]/" turns into "/[5.008006/" for Perl 5.8.6. We also make an exception for "^" because it
has special meaning (negation) in a character class. Finally, "[" and "]" are exempt, of course, because they are awkward to represent in
character classes.
Note that this policy does not forbid unnecessary escaping. So go ahead and (pointlessly) escape "!" characters.
CONFIGURATION
This Policy is not configurable except for the standard options.
BUGS
Perl treats "m/[#]/x" in unexpected ways. I think it's a bug in Perl itself, but am not 100% sure that I have not simply misunderstood...
This part makes sense:
"#f" =~ m/[#]f/x; # match
"#f" =~ m/[#]a/x; # no match
This doesn't:
$qr = qr/f/;
"#f" =~ m/[#]$qr/x; # no match
Neither does this:
print qr/[#]$qr/x; # yields '(?x-ism:[#]$qr
)'
CREDITS
Initial development of this policy was supported by a grant from the Perl Foundation.
AUTHOR
Chris Dolan <cdolan@cpan.org>
COPYRIGHT
Copyright (c) 2007-2011 Chris Dolan. Many rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module
perl v5.14.2 20Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters(3pm)