I don't want to use echo because I want the first line to be a comment, and the rest to be values that a script reads from. If the user deletes the commented line like they're not supposed to, i want the script not to fail and to replace the line. I want sed to say:
but only to the first line. I don't want #CUSTOM to be all over the place where there's new lines.
my commands go in order: touch infile; sed (add #CUSTOM to beginning of this file). I don't want each iteration of the script to add #CUSTOM to the beginning. ONLY if line one is empty or does not contain #CUSTOM
Dear Folks :),
I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp.
I can do this in vi editor by using this command :g/^/s//BBB_
e,g I have a file named as Test.dat and it containins below text:
michal... (4 Replies)
Hi all,
I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output.
sed '$a\
hi...
' shell > shell1
But I face problem when using the same in script. It is throwing the error as,
sed: command garbled:... (4 Replies)
sed '1r file.txt' <source.txt >desti.txt
This example will insert 'file.txt' between line 1 and 2 of source.txt.
sed '0r file.txt' <source.txt >desti.txt
gives an error message.
Does anyone know how 'sed' can insert 'file.txt' before the first line of source.txt? (18 Replies)
Hi All,
I have a file.txt which seems like having three lines.
wc -l file.txt
3 file.txt
In fact, once it is open in text editor, this file has four lines where the last line is empty. how can i delete this last empty line of the file.txt? I tried the codes below so far but they... (6 Replies)
I have an awk script to extract data from several files and create output in the following format as a csv file:
xxxx 01/04/12 0001 0
When data is present, I have a file. When no data is available in the input files, I would still like to create a file that looks like this:
xxxx... (1 Reply)
Hi,
I want to insert the text 'Unknown' in 2 specific columns in a csv file (actually | separated) if the column is blank. Its always the same columns.
I have tried using sed: sed "s/||/|Unknown|/g"
but there are occasion where other fields are blank and they need to be left blank. This... (4 Replies)
I have a test file that I want to read and insert only certain lines into the
the table based on a filter.
1. Rread the log file 12 Hours back Getdate() -12 Hours
2. Extract the following information on for lines that say "DUMP is
complete"
A. Date
B. Database Name
C.... (2 Replies)
Hi All,
I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise
My intention is to insert a line of text after 13th line of every file inside a particular directory.
While trying to do it for a single file , i am using sed
sed '3 i this is the 4th line' filename
sed: command garbled: 3... (5 Replies)
Discussion started by: gotamp
5 Replies
LEARN ABOUT PHP
http_persistent_handles_ident
HTTP_PERSISTENT_HANDLES_IDENT(3) 1 HTTP_PERSISTENT_HANDLES_IDENT(3)http_persistent_handles_ident - Get/set ident of persistent handles
SYNOPSIS
string http_persistent_handles_ident ([string $ident])
DESCRIPTION
Query or define the ident of persistent handles.
PARAMETERS
o $ident
- the identification string
RETURN VALUES
Returns the prior ident as string on success or FALSE on failure.
EXAMPLES
Example #1
A http_persistent_handles_ident(3) example
<?php
echo http_persistent_handles_ident("CUSTOM"), "
";
echo http_persistent_handles_ident("MyApp1"), "
";
http_get("http://www.example.com/");
print_r(http_persistent_handles_count());
?>
The above example will output:
CUSTOM stdClass Object (
[http_request] => Array
(
[MyApp1] => Array
(
[used] => 0
[free] => 1
)
)
[http_request_datashare] => Array
(
[GLOBAL] => Array
(
[used] => 1
[free] => 0
)
)
[http_request_pool] => Array
(
)
)
SEE ALSO http_persistent_handles_count(3), http_persistent_handles_clean(3).
PHP Documentation Group HTTP_PERSISTENT_HANDLES_IDENT(3)