We understood that - but this is what you actually did with your regexp:
Quote:
I tried used a sed command like "echo "s/\[/\example\/string" /g > temp
If you want to replace "data3" with "something_else" the regexp for this is:
It might be that "data3" is occurring several times in the text and you want to change only the occurrences where "data3" is enclosed in rectangular brackets (change "[data3]", but not, say, "(data3)"), preserving the brackets.
for this the regexp would have to look like:
Notice that i put the the brackets to be preserved in the replacement string. Regexps work like that: first the search-part is searched for and - if it is found at all - everything matching this first part is removed from the line. Then the replacement string is prepared and inserted into the place where the search-string was.
As we matched to brackets before they would have been removed if they are not being reinserted with the replacement.
Greetings.
I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file.
I'm struggling to see how each line can be... (5 Replies)
Hi All,
Please let me know a command to parse the below line and find the words,
I have a line like this
40609 39930
In this above line the two words are separted by space.The length of this two words may differ.
I want to put 40609 in var_one and 39930 in var_two.
Eg.
Input line is ... (1 Reply)
hello mighty all
there is a line of 50 words and i need to take a random number of words from the beginning (20 words for example) then put my word then add other 10 words from the continue then add another my special word then add 20 words till the end..
my own knowledge base can say it is... (12 Replies)
Hi,
I need to parse input file from 2nd line.
Input file contents are,
ABC123;20100913115432;2000000;NO;
04;AAA;09;DDD;601020304;AAAA;1;OPTA1;OPTA2;;;
04;BBB;09;BBB;601020304;BBBB;0;OPTB1;OPTB2;OPTB3;OPTB4;OPTB5;
04;CCC;09;DDD;601020304;CCCC;1;;;;;
For each line,
1] I need to check... (17 Replies)
FOLKS ,
i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one.
thanks...
Venu (3 Replies)
Hello,
I have serveral SUN Web servers that need to write a KSH to figure out where Apache is installed and, tar up the directory (for backup purposes) once a month. The trick is that Apache is not installed in same location. So when I do "ps -ef| grep httpd" it shows on some boxes from... (2 Replies)
Hi,
I am new to shell scripting. I need a bash shell scripts which search and grep a parameter value from input.txt file and insert it in between two semicolon of second line of output.txt file.
For example
The shell script search an IP address as parameter value from input.txt ... (2 Replies)
Hi,
I have this script,
while
do
ps ax|grep 5060 > log.txt
echo " "
sleep 1
done
}
I want to actually put a new line everytime the loop is executed in log.txt , but I do not know how to "embed" the echo " " inside the log.txt.
(so to say... (1 Reply)
Hi,
I am trying to put together a Korn Shell script to insert at a specific line.
The system we use is SunOS 5.10
I can get the line number by using:-
num=`sed -n '/export ENV/=' ./tmp.file`
Not getting much headway using the above variable's value to insert -
export SYBASE=/opt/sybase15... (5 Replies)
Hello,
I am looking to automate a task - which is updating an existing access control instruction of a server and making sure that the attributes defined in the instruction is in sorted order. The instructions will be of a specific syntax.
For example lets assume below listed is one of an... (6 Replies)
Discussion started by: sanjayroc
6 Replies
LEARN ABOUT PHP
imap_mail_compose
IMAP_MAIL_COMPOSE(3) 1 IMAP_MAIL_COMPOSE(3)imap_mail_compose - Create a MIME message based on given envelope and body sectionsSYNOPSIS
string imap_mail_compose (array $envelope, array $body)
DESCRIPTION
Create a MIME message based on the given $envelope and $body sections.
PARAMETERS
o $envelope
- An associative array of headers fields. Valid keys are: "remail", "return_path", "date", "from", "reply_to", "in_reply_to",
"subject", "to", "cc", "bcc", "message_id" and "custom_headers" (which contains associative array of other headers).
o $body
- An indexed array of bodies A body is an associative array which can consist of the following keys: "type", "encoding",
"charset", "type.parameters", "subtype", "id", "description", "disposition.type", "disposition", "contents.data", "lines", "bytes"
and "md5".
RETURN VALUES
Returns the MIME message.
EXAMPLES
Example #1
imap_mail_compose(3) example
<?php
$envelope["from"]= "joe@example.com";
$envelope["to"] = "foo@example.com";
$envelope["cc"] = "bar@example.com";
$part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed";
$filename = "/tmp/imap.c.gz";
$fp = fopen($filename, "r");
$contents = fread($fp, filesize($filename));
fclose($fp);
$part2["type"] = TYPEAPPLICATION;
$part2["encoding"] = ENCBINARY;
$part2["subtype"] = "octet-stream";
$part2["description"] = basename($filename);
$part2["contents.data"] = $contents;
$part3["type"] = TYPETEXT;
$part3["subtype"] = "plain";
$part3["description"] = "description3";
$part3["contents.data"] = "contents.data3
";
$body[1] = $part1;
$body[2] = $part2;
$body[3] = $part3;
echo nl2br(imap_mail_compose($envelope, $body));
?>
PHP Documentation Group IMAP_MAIL_COMPOSE(3)