12-11-2012
Try using sub(/.*\//,"",$11); before the print statement..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have configuration file(master.cnf), that contents are:
VER1LOG /src/ver1/log
VER2LOG /src/ver2/log
APPLOG /src/sys/apps/log
APPCONF /src/sys/apps/conf
APPBIN /src/sys/apps/bin
my shell script is as below
mylog=sys/apps
awk "/$mylog/" master.cnf
awk: syntax error Context is:
>>> ... (6 Replies)
Discussion started by: McLan
6 Replies
2. Shell Programming and Scripting
Hi All,
Can you please help me with the below issue.
I want only the last slash to be replaced with space.
06/05/2008/EDED_FD_BDCD_ABCD_123
06/05/2008 EDED_FD_BDCD_ABCD_123 (3 Replies)
Discussion started by: christineida
3 Replies
3. Shell Programming and Scripting
Hi All,
print "path/executable_file parameters" \
> path/file1
print "path/executable_file parameters" \
> path/file2
print "path/executable_file parameters" \
> path/file3
chmod 775 path/file1 \
path/file2 \
... (7 Replies)
Discussion started by: Arunprasad
7 Replies
4. UNIX for Advanced & Expert Users
Hi,
I have a path like this c:\test\sample\programs, i need to change thiis to c:\\test\\sample\\programs. How to perform this? I tried tr command but it didn't help me.
Thanks
Vijayan (3 Replies)
Discussion started by: mvictorvijayan
3 Replies
5. Shell Programming and Scripting
Hi all,
I need to know way of inserting backward slash before forward slash. My problem is that i need to supply directory path as an argument while invoking cshell script. This argument is further used in script (i.e. sed is used to insert this path in some file). So i need to place \ in front... (2 Replies)
Discussion started by: sarbjit
2 Replies
6. Shell Programming and Scripting
Hi,
I have a string like ABC.123.XYZ-A1-B2-P1-C4. I want to delimit the string based on "-" and then get result as only two strings. One with string till last hyphen and other with value after last hyphen... For this case, it would be something like first string as "ABC.123.XYZ-A1-B2-P1" and... (6 Replies)
Discussion started by: gupt_ash
6 Replies
7. Shell Programming and Scripting
Hi all,
I have a number of strings like below:
//mnt/autocor/43°13'(33")W/
and i'm trying to get the numbers in this string, for example
431333
please help
thanks ahead (14 Replies)
Discussion started by: sunnydanniel
14 Replies
8. Shell Programming and Scripting
Hi,
I have a No Delimiter variable length text file with following schema -
Column Name Data length
Firstname 5
Lastname 5
age 3
phoneno1 10
phoneno2 10
phoneno3 10
sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies
9. Shell Programming and Scripting
I got stuck in problem i need to remove slash but it is not working.
current output
/usr/sbin/httpd
expected output
usr sbin httpd (4 Replies)
Discussion started by: learnbash
4 Replies
10. Shell Programming and Scripting
Hi,
Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV
I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters.
Any help would... (2 Replies)
Discussion started by: JPB1977
2 Replies
LEARN ABOUT DEBIAN
perl::critic::policy::valuesandexpressions::prohibitcommaseparat
Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommUseraContPerl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements(3pm)
NAME
Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements - Don't use the comma operator as a statement separator.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Perl's comma statement separator has really low precedence, which leads to code that looks like it's using the comma list element separator
not actually doing so. Conway suggests that the statement separator not be used in order to prevent this situation.
The confusion that the statement separator causes is primarily due to the assignment operators having higher precedence.
For example, trying to combine two arrays into another like this won't work:
@x = @y, @z;
because it is equivalent to
@x = @y;
@z;
Conversely, there are the built-in functions, like "print", that normally force the rest of the statement into list context, but don't when
called like a subroutine.
This is not likely to produce what is intended:
print join q{, }, 2, 3, 5, 7, ": the single-digit primes.
";
The obvious fix is to add parentheses. Placing them like
print join( q{, }, 2, 3, 5, 7 ), ": the single-digit primes.
";
will work, but
print ( join q{, }, 2, 3, 5, 7 ), ": the single-digit primes.
";
will not, because it is equivalent to
print( join q{, }, 2, 3, 5, 7 );
": the single-digit primes.
";
CONFIGURATION
This policy can be configured to allow the last statement in a "map" or "grep" block to be comma separated. This is done via the
"allow_last_statement_to_be_comma_separated_in_map_and_grep" option like so:
[ValuesAndExpressions::ProhibitCommaSeparatedStatements]
allow_last_statement_to_be_comma_separated_in_map_and_grep = 1
With this option off (the default), the following code violates this policy.
%hash = map {$_, 1} @list;
With this option on, this statement is allowed. Even if this option is off, using a fat comma "=>" works, but that forces stringification
on the first value, which may not be what you want.
BUGS
Needs to check for "scalar( something, something )".
AUTHOR
Elliot Shank "<perl@galumph.com>"
COPYRIGHT
Copyright (c) 2007-2011 Elliot Shank.
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 Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements(3pm)