Hi ,
Can anybody explain how this perl one liner works..
It is to test whether the number is prime or not
perl -le 'print "PRIME" if (1 x shift) !~ /^(11+)\1+$/' 19
Thanks in advance
Shihab (2 Replies)
Greetings, I attempting to create a line statement that will do the following:
1. Read the input file
2. Extract lines containing certain keep words
3. Print the lines in a tabular format (CSV)
Help is what I have so far:
# cat text.tx | egrep -i -e "(Check Name) | (Risk Level) |... (6 Replies)
I want to use SED to replace all new line characters of a file, I googled and found this one liner
sed '{:q;N;s/\n//g;t q}' infile
what do :q;N; and t q mean in this script? (6 Replies)
abc/abc1/abc2/abc3/abc4
i need a script to pick this above path when ever
any patterns like the below will be found.
abc/abc1
abc/abc1/abc2
abc1/abc2/abc3
abc2/abc3/abc4
abc2/abc3/
etc ....
etc.....
not only the above 5 but like these one..
any one liner will be of great... (1 Reply)
Hi I have a log data that shows chunks of data like this:
thisis example test, this is example test, this is example test
thisis example test, this is example test, this is example test
thisis example test, this is example test, this is example test
thisis example test, this is example test,... (2 Replies)
Thanks for giving your time and effort to answer questions and helping newbies like me understand awk.
I have a huge file, millions of lines, so perl takes quite a bit of time, I'd like to convert these perl one liners to awk.
Basically I'd like all lines with ISA sandwiched between... (9 Replies)
I have a data base of part numbers:
AAA Thing1
BBB Thing2
CCC Thing3
File one is a list of part numbers:
AAA234
BBB678
CCC2345
Is there a sed one-line that would compare a data base with and replace the part numbers so that the output looks like this?
AAA234 Thing1
BBB678 Thing2... (5 Replies)
Hello,
I am trying to sort/get some specific output from a ls command but however I am having no luck. The command I am using is
'ls -al /nim/dr/mksysb/\*'|grep -e _dr -e .tgz|cut -c37-90|cut -d" " -f2-8|cut -d_ -f1
the error is
bash: ls -al /nim/dr/mksysb/\*: No such file or directory
... (1 Reply)
Discussion started by: hasn318
1 Replies
LEARN ABOUT PHP
get_class_vars
GET_CLASS_VARS(3) 1 GET_CLASS_VARS(3)get_class_vars - Get the default properties of the classSYNOPSIS
array get_class_vars (string $class_name)
DESCRIPTION
Get the default properties of the given class.
PARAMETERS
o $class_name
- The class name
RETURN VALUES
Returns an associative array of declared properties visible from the current scope, with their default value. The resulting array elements
are in the form of varname => value. In case of an error, it returns FALSE.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.0.3 | |
| | |
| | get_class_vars(3) will only return the properties |
| | that can be accessed from the current scope. |
| | |
| 5.0.2 | |
| | |
| | Calling get_class_vars(3) will now expose all |
| | the properties as an array, unlike previous be- |
| | haviour where protected and private properties |
| | were prefixed with nul bytes. |
| | |
| 5.0.1 | |
| | |
| | Calling get_class_vars(3) will expose all prop- |
| | erties, as when converting an object to a class. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
get_class_vars(3) example
<?php
class myclass {
var $var1; // this has no default value...
var $var2 = "xyz";
var $var3 = 100;
private $var4;
// constructor
function myclass() {
// change some properties
$this->var1 = "foo";
$this->var2 = "bar";
return true;
}
}
$my_class = new myclass();
$class_vars = get_class_vars(get_class($my_class));
foreach ($class_vars as $name => $value) {
echo "$name : $value
";
}
?>
The above example will output:
var1 :
var2 : xyz
var3 : 100
Example #2
get_class_vars(3) and scoping behaviour
<?php
function format($array)
{
return implode('|', array_keys($array)) . "
";
}
class TestCase
{
public $a = 1;
protected $b = 2;
private $c = 3;
public static function expose()
{
echo format(get_class_vars(__CLASS__));
}
}
TestCase::expose();
echo format(get_class_vars('TestCase'));
?>
The above example will output:
// 5.0.0
a| * b| TestCase c
a| * b| TestCase c
// 5.0.1 - 5.0.2
a|b|c
a|b|c
// 5.0.3 +
a|b|c
a
SEE ALSO get_class_methods(3), get_object_vars(3).
PHP Documentation Group GET_CLASS_VARS(3)