You can't nest backticks like that. However, there's an alternate syntax which works.
You would be more likely to get useful replies if you pared down the question to just the specific problem you have, rather than post an enormous script.
Hey,
Thanks for suggestions.
Can you tell me how to resolve that backticks in my code ?
As per my code, i am using awk, and how to resolve that nested feature ?
Please let me know, appreciate all your help.
Hi All, :confused:
I have the following code.
var=' '
sqlplus user/pass@DB <<EOF
whenever sqlerror exit 1
select package.func() into $var from dual;
EOF
echo $var
But, this code does not work to display the value returned by the oracle function. Do we have to bind variables before... (3 Replies)
Dear all,
In my code,i am planning to use memset function to re-initialise an array before populating it everytime. Will using memset function be an overload to the program? (3 Replies)
i have a record like
1,23423,4545,6767,89898,3434,121212,123123,322
2,23233,3434,4545,56566,rxrx,e344343,343434,3434
1,23223,336,78787,78787,654,6767677,6877989,7878
i want to check the $6 field if its start with any letters, i want to move this record to some other file and keep rest of... (2 Replies)
Thank everyone advanced.
Would you please tell me how to use the shell variable in the awk body?
I try follows but they all do not work, pls kindly help me:
1.
str=`cat file2`
awk 'BEGIN{print("'"$str"'"}' file1 > file3
2.
str=`cat file2`
awk 'BEGIN{print(ENVIRON}' file1 > file3
3.... (3 Replies)
Hi
i am trying to read a line from a file and add the values in a new file
eg
Input file
a1|a2|a3|a4|a5|a6
b1|b2|b3|b4|b5|b6
c1|c2|c3|c4|c5|c6
expected output
File one
a1|a2|a3
b1|b2|b3
c1|c2|c3 (3 Replies)
Hi All,
I have a perl script(1.pl) that calls a c function defined in another file sample.c
#!/usr/bin/perl
my $re = 1;
my @s = `/home/PERL_SCRIPTING/Rough/sample pline $re 10`;
print "$_" foreach(@s);
The sample.c is as bwlow:
# include <stdio.h>
int pline(int, int);... (4 Replies)
Hi
I have a scenario where i have a file name as
abcd_To_hfgh.20090456778_1.dat
I will get the filename as parameter
and i need a string in between second _ and first . i.e i need hfgh in this case.
Please help me with the script. This may not be awk script even if it can be... (2 Replies)
Hi All,I need to convert following field from a file
L2578978CLC/576/116804 => L2578978CLC/00000576/00168304
i have to append Zeros in the third and fourth number after slash / in the above string (total length of number should be 8).
means L2578978CLC/576/116804 should be converted to... (3 Replies)
Hi,
I've written a perl script with a nested foreach statement in it.
I have the line
code:
foreach $argn(@arguments) {
foreach $location (@path) {
system("find $location -name \"$argn\" -print >> results.txt");
... (2 Replies)
Perl::Critic::Policy::InputOutput::ProhibitBacktickOperaUser(Contributed Perl DocPerl::Critic::Policy::InputOutput::ProhibitBacktickOperators(3pm)NAME
Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators - Discourage stuff like "@files = `ls $directory`".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Backticks are super-convenient, especially for CGI programs, but I find that they make a lot of noise by filling up STDERR with messages
when they fail. I think its better to use IPC::Open3 to trap all the output and let the application decide what to do with it.
use IPC::Open3 'open3';
$SIG{CHLD} = 'IGNORE';
@output = `some_command`; #not ok
my ($writer, $reader, $err);
open3($writer, $reader, $err, 'some_command'); #ok;
@output = <$reader>; #Output here
@errors = <$err>; #Errors here, instead of the console
CONFIGURATION
Alternatively, if you do want to use backticks, you can restrict checks to void contexts by adding the following to your .perlcriticrc
file:
[InputOutput::ProhibitBacktickOperators]
only_in_void_context = 1
The purpose of backticks is to capture the output of an external command. Use of them in a void context is likely a bug. If the output
isn't actually required, "system()" should be used. Otherwise assign the result to a variable.
`some_command`; #not ok
$output = `some_command`; #ok
@output = `some_command`; #ok
NOTES
This policy also prohibits the generalized form of backticks seen as "qx{}".
See perlipc for more discussion on using "wait()" instead of "$SIG{CHLD} = 'IGNORE'".
You might consider using the "capture()" function from the IPC::System::Simple module for a safer way of doing what backticks do,
especially on Windows. The module also has a safe wrapper around "system()".
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All 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 2012-06-07 Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators(3pm)