09-30-2009
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I need to extract a file,which contains the path to a new path.
sample tar file
tar -tfv class.tar | grep client
-rw------- 0/1 99 Jan 22 12:46 2004 /usr/openv/netbackup/db/class/mariner/clients
-rw------- 0/1 102 Sep 25 11:33 2007... (1 Reply)
Discussion started by: jouuu
1 Replies
2. Shell Programming and Scripting
Hi:
I have a requirement as below:
I have some standard Unix commands modified and kept them in a directory say /usr/clsh/bin. For example I have a script named "ls" kept here which is modified version of "ls" (say it always gives long listing i.e. ls -l).
When any user logs on and types... (2 Replies)
Discussion started by: ramesh_samane
2 Replies
3. Shell Programming and Scripting
Hi,
Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable?
for eg: suppose the PATH is being set as follows
PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4
... (2 Replies)
Discussion started by: royalibrahim
2 Replies
4. UNIX for Dummies Questions & Answers
I make this script that uses "strace" to trace programs. The script looks for files that the program opens. It looks like this
open("/lib/libtermcap.so.2", O_RDONLY) = 3
open("/dev/tty", O_RDWR|O_NONBLOCK|O_LARGEFILE) = 3
I want to extract the path without the quotes, preferably using grep and... (4 Replies)
Discussion started by: Samuel Gordon
4 Replies
5. Shell Programming and Scripting
/Path/snowbird9/nrfCompMgrRave1230100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.
/Path/snowbird6/nrfCompMgrRave1220100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.
/Path/snowbird14/nrfCompMgrRave920100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.... (0 Replies)
Discussion started by: Shirisha
0 Replies
6. Shell Programming and Scripting
Hi All,
Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created.
/Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt
/Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Discussion started by: karthikgv417
6 Replies
7. Shell Programming and Scripting
Hi experts,
I have multiple file names ending with .jsp located in $SOME_DIR, $SOME_DIR/f1/,$SOME_DIR/f2/test,$SOME_DIR/f3/fa
and there are equivalent class files in $SOME_DIR/WEB-INF/classes/_pages,$SOME_DIR/WEB-INF/classes/_pages/_f1,... (0 Replies)
Discussion started by: oraclermanpt
0 Replies
8. UNIX for Advanced & Expert Users
Currently I am using this laborious command
lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}'
Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies
9. UNIX for Beginners Questions & Answers
Hello,
I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies
10. Programming
i have make file which i try to make them generic
but it keeps to compline it missing include directory
this is the makefile :
CXX=g++
CPPFAGS= -Wall -O0 -g -std=c++14
INCLUDES = -I/home/vagrant/libuv/include -Isrc
LIBS_DIRS = -L/home/vagrant/libuv/build
LDFLAGS=... (7 Replies)
Discussion started by: umen
7 Replies
LEARN ABOUT CENTOS
perl::critic::policy::regularexpressions::prohibitescapedmetacha
Perl::Critic::Policy::RegularExpressions::ProhibitEscapeUseraContributedPerl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters(3)
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.16.3 2014Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters(3)