03-02-2020
Quote:
Originally Posted by
shanul karim
.
.
.
Its not working.. Thanks
... is not something people can start analysing / debugging a problem upon. Nor is your code as presented.
First step is get rid of the syntax errors encountered.
Apply adequate structuring like indenting and block building - your choice, but stick to it - to improve readabiltiy and understandability. Same holds for your free text, BTW,
Show results (even if non-satisfying; explain why, then) and error messages / warning, whatever applies.
I don't see a
CS variable anywhere in your code or data, nor do I see a value of 2. A string "AdmState" can't be found. Why should the block with
shaNmfTode=DL-8 be selected for printout, and where do the
AdminState=SOCKED(1) and
OperState=DWNLED(1) values come from?
This User Gave Thanks to RudiC For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to make a script that will replace backslashes in a file, but only if the occurance is a pathname. In the file, there are a lot of regular expressions as well, so I'm trying to preserve the integrity of those regular expressions, but convert Windows relative paths. I'm using bash and... (1 Reply)
Discussion started by: Loriel
1 Replies
2. Shell Programming and Scripting
how can i use two or multiple statements in the if part
of an awk code
for example
i want to check two flag if they are true i will write some print
operations and increase the counter.
here is the c version of the code that i want to write:
counter=0;
if (flag1==1 && flag2==0) {... (7 Replies)
Discussion started by: gfhgfnhhn
7 Replies
3. Shell Programming and Scripting
I have an awk statement that works but I am calling awk twice and I know there has to be a way to combine the two statements into one. The purpose is to pull out just the ip address from loopback1.
cat config.txt | nawk 'BEGIN {FS="\n"}{RS="!"}{if ( $0 ~ "interface loopback1" ) print$4}' | nawk... (5 Replies)
Discussion started by: numele
5 Replies
4. Shell Programming and Scripting
I have a pretty simple script below:
#!/bin/sh
for i in *.cfg
do
temp=`awk '/^InputDirectory=/' ${i}`
input_dir=`echo ${temp} | awk '{ print substr( $0, 16) }'`
echo ${input_dir}
done
As you can see its opening each cfg file and searching for the line that has "InputDirectory="... (3 Replies)
Discussion started by: ssbsts
3 Replies
5. UNIX for Dummies Questions & Answers
I'm converting some code from ksh on my macbook (Version M 1993-12-28 s+) to an older solaris machine with ksh 88.
I can't seem to figure out this line, it worked on the new shell version.
set -A combo -- $(for x in ${ImageIDs};
do
nawk -v s=$x 'if($2 == s) getline ; getline if ($1 ==... (2 Replies)
Discussion started by: nerdcurious
2 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have the following two awk statements which I'd like to consolidate into one by piping the output from the first into the second awk statement (rather than having to write kat.txt out to a file and then reading back in).
awk 'BEGIN {FS=OFS=" "} {printf("%s ", $2);for (x=7; x<=10;... (3 Replies)
Discussion started by: kasan0
3 Replies
7. Shell Programming and Scripting
Dear All,
I indeed your help for managing resarch data file.
for example I have,
data1.txt :
type of atoms z vz
Si 34 54
O 20 56
H 14 13
Si 40 17
O ... (11 Replies)
Discussion started by: ariesto
11 Replies
8. Shell Programming and Scripting
i have a datafile that has several lines that look like this:
2,dataflow,Sun Mar 17 16:50:01 2013,1363539001,2990,excelsheet,660,mortar,660,4
using the following command:
awk -F, '{$3=strftime("%a %b %d %T %Y,%s",$3)}1' OFS=, $DATAFILE | egrep -v "\-OLDISSUES," | ${AWK} "/${MONTH} ${DAY}... (7 Replies)
Discussion started by: SkySmart
7 Replies
9. Shell Programming and Scripting
Hello again everyone,
yes, I'm back again for more help! So I'm attempting to read two separate files and generate some XML code from that. My current code is:
BEGIN {
print "<?xml version=\"1.0\" encoding=\"utf-8\">"
print "<Export>"
}
{
x=1;
print "<section name=\"Query" NR "\">"... (5 Replies)
Discussion started by: Parrakarry
5 Replies
10. Shell Programming and Scripting
Hi
What is the right structure to use awk with multiple If statements
The following code doesn't work
#
awk '
{
A = $1
}
END {
for ( i = 1; i <= c; i++ )
{
if ( A == 236 && A ==199... (7 Replies)
Discussion started by: khaled79
7 Replies
LEARN ABOUT CENTOS
universal::can
UNIVERSAL::can(3) User Contributed Perl Documentation UNIVERSAL::can(3)
NAME
UNIVERSAL::can - work around buggy code calling UNIVERSAL::can() as a function
SYNOPSIS
To use this module, simply:
use UNIVERSAL::can;
DESCRIPTION
The UNIVERSAL class provides a few default methods so that all objects can use them. Object orientation allows programmers to override
these methods in subclasses to provide more specific and appropriate behavior.
Some authors call methods in the UNIVERSAL class on potential invocants as functions, bypassing any possible overriding. This is wrong and
you should not do it. Unfortunately, not everyone heeds this warning and their bad code can break your good code.
This module replaces "UNIVERSAL::can()" with a method that checks to see if the first argument is a valid invocant has its own "can()"
method. If so, it gives a warning and calls the overridden method, working around buggy code. Otherwise, everything works as you might
expect.
Some people argue that you must call "UNIVERSAL::can()" as a function because you don't know if your proposed invocant is a valid invocant.
That's silly. Use "blessed()" from Scalar::Util if you want to check that the potential invocant is an object or call the method anyway in
an "eval" block and check for failure (though check the exception returned, as a poorly-written "can()" method could break Liskov and throw
an exception other than "You can't call a method on this type of invocant").
Just don't break working code.
AUTHOR
chromatic, "<chromatic@wgz.org>"
BUGS
Please report any bugs or feature requests to "bug-universal-can@rt.cpan.org", or through the web interface at
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=UNIVERSAL-can>. This will contact me, hold onto patches so I don't drop them, and will
notify you of progress on your request as I make changes.
ACKNOWLEDGEMENTS
Inspired by UNIVERSAL::isa by Yuval Kogman, Autrijus Tang, and myself.
Adam Kennedy has tirelessly made me tired by reporting potential bugs and suggesting ideas that found actual bugs.
Mark Clements helped to track down an invalid invocant bug.
Curtis "Ovid" Poe finally provided the inspiration I needed to clean up the interface.
Peter du Marchie van Voorthuysen identified and fixed a problem with calling "SUPER::can".
Daniel LeWarne found and fixed a deep recursion error.
Norbert Buchmueller fixed an overloading bug in blessed invocants.
The Perl QA list had a huge... discussion... which inspired my realization that this module needed to do what it does now.
COPYRIGHT & LICENSE
Copyright (c) 2005 - 2011, chromatic. This module is made available under the same terms as Perl 5.12.
POD ERRORS
Hey! The above document had some coding errors, which are explained below:
Around line 146:
Non-ASCII character seen before =encoding in 'Buchmueller'. Assuming UTF-8
perl v5.16.3 2012-07-26 UNIVERSAL::can(3)