Hi,
I have a .log file in which it has many values. But i need some specific values. How it can be done using Shell Script. Please explain in detail.
Thankx in advance.
Sathish D V. (8 Replies)
Hi I have a spaced filled file having records like below:
What I want is to read line having RT3 at position 17-19 then go to position 2651 check the 18 characters (might be space filled till 18 characters). This position should have a... (6 Replies)
I have a text file with following content (3 lines)
filename : output.txt
first line:12/12/2008
second line:12/12/2008
third line:Y
I would like to know how we can replace 'Y' with 'N' in the 3rd line keeping 1st and 2nd lines same as what it was before.
I tried using cat output.txt... (4 Replies)
Hi,
I wanted to add specific text to each row in a text file containing three rows. Example:
0 8 7 6 5 5
7 8 9 0 7 9
7 8 9 0 1 2
And I want to add a 21 at the beginning of the first row, and blank spaces at the beginning of the second two rows. To get this:
21 0 8 7 6 5 5
7 8... (4 Replies)
I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it.
For example, Here is a portion of a zone file.
IN NS ns1.domain.tld.
IN NS ns2.domain.tld.
IN ... (2 Replies)
Hi,
I have the following text file:
8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm
9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm
10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm
11 T1mapping_flip15 ok 128 108 30... (2 Replies)
Hi !
I am a newbie and never officially wrote a shell script before.
The requirement for this script is :
1) Read a file called 'bpm.log' and identify if it has a specific text such as 'this is the text'. Its a static value and that is the only text we need to read.
2) If that... (2 Replies)
I have list of files in a directory 'dir'. Each file is of type HTML. I need to read each file and get the string which starts with 'http' and write them in a new text file. How can i do this shell scripting?
file1.html
<head>
<url>http://www.google.com</url>
</head>
file2.html
<head>... (6 Replies)
Hi
This is my first post and I'm just a beginner. So please be nice to me.
I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file?
I have tried sed -n 241,241p... (13 Replies)
Hi,
I have a file(input.txt) and trying to format as output.txt. See the attached file format.
Note: This is a windows file (DOS format) and the commands are also going to execute on windows.
Basically I am trying to capture all the data in between Local Group Memberships and Global Group... (10 Replies)
Discussion started by: Monoj2014
10 Replies
LEARN ABOUT PHP
var_export
VAR_EXPORT(3) 1 VAR_EXPORT(3)var_export - Outputs or returns a parsable string representation of a variableSYNOPSIS
mixed var_export (mixed $expression, [bool $return = false])
DESCRIPTION var_export(3) gets structured information about the given variable. It is similar to var_dump(3) with one exception: the returned represen-
tation is valid PHP code.
PARAMETERS
o $expression
- The variable you want to export.
o $return
- If used and set to TRUE, var_export(3) will return the variable representation instead of outputting it.
RETURN VALUES
Returns the variable representation when the $return parameter is used and evaluates to TRUE. Otherwise, this function will return NULL.
NOTES
Note
When the $return parameter is used, this function uses internal output buffering so it cannot be used inside an ob_start(3) callback
function.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.1.0 | |
| | |
| | Possibility to export classes and arrays con- |
| | taining classes using the __set_state() magic |
| | method. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
var_export(3) Examples
<?php
$a = array (1, 2, array ("a", "b", "c"));
var_export($a);
?>
The above example will output:
array (
0 => 1,
1 => 2,
2 =>
array (
0 => 'a',
1 => 'b',
2 => 'c',
),
)
<?php
$b = 3.1;
$v = var_export($b, true);
echo $v;
?>
The above example will output:
3.1
Example #2
Exporting classes since PHP 5.1.0
<?php
class A { public $var; }
$a = new A;
$a->var = 5;
var_export($a);
?>
The above example will output:
A::__set_state(array(
'var' => 5,
))
Example #3
Using __set_state() (since PHP 5.1.0)
<?php
class A
{
public $var1;
public $var2;
public static function __set_state($an_array)
{
$obj = new A;
$obj->var1 = $an_array['var1'];
$obj->var2 = $an_array['var2'];
return $obj;
}
}
$a = new A;
$a->var1 = 5;
$a->var2 = 'foo';
eval('$b = ' . var_export($a, true) . ';'); // $b = A::__set_state(array(
// 'var1' => 5,
// 'var2' => 'foo',
// ));
var_dump($b);
?>
The above example will output:
object(A)#2 (2) {
["var1"]=>
int(5)
["var2"]=>
string(3) "foo"
}
NOTES
Note
Variables of type resource couldn't be exported by this function.
Note
var_export(3) does not handle circular references as it would be close to impossible to generate parsable PHP code for that. If you
want to do something with the full representation of an array or object, use serialize(3).
Warning
When var_export(3) exports objects, the leading backslash is not included in the class name of namespaced classes for maximum com-
patibility.
SEE ALSO print_r(3), serialize(3), var_dump(3).
PHP Documentation Group VAR_EXPORT(3)