I'm needing to add a "hour:min" to the end of each line in a document. The document in this case is only going to be one line.
if this inserts it at the end, what needs to be changed to add something at the end...
/bin/echo "%s/^/$filler/g\nwq!" | ex -s $oFile
Thank you... (2 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)
hello i need some help here are the contents of my file.
test.txt
this is filename 1.mp3 http://www.url.com/filenamehashed
filename 2.mp3 http://www.url.com/fileamehashed
something_else.zip http://www.url.com/filenamehashed
so this file has 100 of these lines
filename url
I would... (9 Replies)
Dear Friends,
I have a flat file where last line of it has word D$mhtt
I want to add a space and back slash after it.
Also wanna add -S "J" in the last line.
Following example will make it clear.
I have this in the last line of file
D$mhtt
I want
D$mhtt \
-S "J"
Please... (5 Replies)
I have a tab delimited text file,
id name distance
1 3325167 0.334561754018
2 3290488 0.389444269458
3 3288794 0.392312701782
4 3347602 0.392532202097
5 3295355 0.394394169485
I need to add a line after the header line. The first and third field of... (3 Replies)
I have a text file that has data like:
Data "12345#22"
Fred
ID 12345
Age 45
Wilma
Dino
Data "123#22"
Tarzan
ID 123
Age 33
Jane
I need to figure out a way of adding 1,000,000 to the specific lines (always same format) in the file, so it becomes:
Data "1012345#22"
Fred
ID... (16 Replies)
Hi,
I want to add a text to the end of the specific line in a file. Now my file looks like this:
999
111
222
333
111
444
I want to add the string " 555" to the end of the first line contaning 111. Moreover, I want to insert a newline after this line containg the "000" string. The... (8 Replies)
Hey guys,
I need to write a script that will add a specific text at the end of a specific line (of a text file). but the line is a variable
this is my text file :
device_2 ansible_ssh_host=127.0.0.1 ansible_ssh_port=30000 ansible_ssh_user='root'
device_2 ansible_ssh_host=127.0.0.1... (1 Reply)
Hi,
I am doing something like below:
cat file1>file3and
cat file2>>file3
I wanted to check if there is a way to write a custom message(hardcoded message)something like below at the beginning of each line then PIPE delimitiation and then followed by remaining record.
cat file1... (7 Replies)
the first line of every unix script written in an interpreted language always has a "#!<path-to-the-language>"
is there a way to include other text in that first line without it affecting the ability of the script to run???
for instance, if i change the following line:
#!/bin/sh
echo blah... (1 Reply)
Discussion started by: SkySmart
1 Replies
LEARN ABOUT PHP
eval
EVAL(3) 1 EVAL(3)eval - Evaluate a string as PHP codeSYNOPSIS
mixed eval (string $code)
DESCRIPTION
Evaluates the given $code as PHP.
Caution
The eval(3) language construct is very dangerous because it allows execution of arbitrary PHP code. Its use thus is discouraged.
If you have carefully verified that there is no other option than to use this construct, pay special attention not to pass any user
provided data into it without properly validating it beforehand.
PARAMETERS
o $code
- Valid PHP code to be evaluated. The code mustn't be wrapped in opening and closing PHP tags, i.e. 'echo "Hi!";' must be passed
instead of '<? echo "Hi!"; >'. It is still possible to leave and reenter PHP mode though using the appropriate PHP tags, e.g.
'echo "In PHP mode!"; ?>In HTML mode!<? echo "Back in PHP mode!";'. Apart from that the passed code must be valid PHP. This
includes that all statements must be properly terminated using a semicolon. 'echo "Hi!"' for example will cause a parse error,
whereas 'echo "Hi!";' will work. A return statement will immediately terminate the evaluation of the code. The code will be exe-
cuted in the scope of the code calling eval(3). Thus any variables defined or changed in the eval(3) call will remain visible
after it terminates.
RETURN VALUES eval(3) returns NULL unless return is called in the evaluated code, in which case the value passed to return is returned. If there is a
parse error in the evaluated code, eval(3) returns FALSE and execution of the following code continues normally. It is not possible to
catch a parse error in eval(3) using set_error_handler(3).
EXAMPLES
Example #1
eval(3) example - simple text merge
<?php
$string = 'cup';
$name = 'coffee';
$str = 'This is a $string with my $name in it.';
echo $str. "
";
eval("$str = "$str";");
echo $str. "
";
?>
The above example will output:
This is a $string with my $name in it.
This is a cup with my coffee in it.
NOTES
Note
Because this is a language construct and not a function, it cannot be called using variable functions.
Tip
As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of
this function, and save it in a string (for example).
Note
In case of a fatal error in the evaluated code, the whole script exits.
SEE ALSO call_user_func(3).
PHP Documentation Group EVAL(3)