Hi,
I have this line in a file called test.cfg
SOURCEFILE=/usr/platform/sun4v/driver/file.cfg
But i have many occurances of "SOURCEFILE" in test.cfg , i need to search only for this line and replace that line with
SOURCEFILE=/usr/platform/sun4x/driver/file.cfg
again there are many... (17 Replies)
Hi All,
I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text.
An example of 4 lines in my file is:
1. MatchText_randomNumberOfText moreData ReplaceMe moreData
2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
I have a perl function in my script that needs to replace an entire line in a file
sub changestate {
my $base = ();
my @base = ();
open(BASE, $file) || die("Could not open file!");
@base=<BASE>;
close (BASE);
foreach $base(@base)
{
if($base =~... (1 Reply)
hai
i am very new to unix.
i am having two files like this.
first.properties
cache.ZA.TL_CCY=SELECT trim(CCY_CODE)||trim(COUNTRY_CODE)||trim(CITY_CODE) AS... (4 Replies)
Hi
I have a log file (say log.txt). I have to search for a line which has the string ( say ERROR) in the log file and copy 15 lines after this into another file (say error.txt). Can someone give me the code and this has to be in PERL
Thanks in advance
Ammu (3 Replies)
Hi,
I need help. I have XML file as below
<a n="infoLevel">
<v s="true"/>
</a>
<a n="localAddr">
<v s="server.host.com"/>
</a>
<a n="ListenPort">
<v s="21111"/>
</a>
I need to find variable "ListenPort" in line and then replace... (4 Replies)
Unix box server version
***********
>uname -r
B.11.00
>echo $SHELL
/usr/bin/ksh
--> in this server, I have the path like /IMbuild/dev/im0serv1
---> in that directory I have the folders startup(.jsp files nearly 100 jsp's ) and scripts(contains .js files nearly 100 files) ... (9 Replies)
Hi All,
i can replace a perticular value in sentence using perl.
perl -pi -e 's/old/new/' sample.txt
but i am not able to replace whole string by perl.
file1 contains "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.147.109.211)(PORT=1526))(CONNECT_DATA=(SID= MWDBD22)))". i... (3 Replies)
I have a file which requires modification via a shell script.
Need to do the following: 0. take input from user for new text. 1. search for a keyword in the file. 2. replace the line next to this to this keyword with user supplied input.
for e.g., my file has the following text:
(some... (7 Replies)
All, I appreciate any help you can offer here as this is well beyond my grasp of awk/sed...
I have an input file similar to:
&LOG
&LOG Part: "@DB/TC10000021855/--F"
&LOG
&LOG
&LOG Part: "@DB/TC10000021852/--F"
&LOG Cloning_Action: RETAIN
&LOG Part: "@DB/TCCP000010713/--A"
&LOG
&LOG... (5 Replies)
Discussion started by: KarmaPoliceT2
5 Replies
LEARN ABOUT PHP
copymsg
copymsg(9F) Kernel Functions for Drivers copymsg(9F)NAME
copymsg - copy a message
SYNOPSIS
#include <sys/stream.h>
mblk_t *copymsg(mblk_t *mp);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
mp Pointer to the message to be copied.
DESCRIPTION
copymsg() forms a new message by allocating new message blocks, and copying the contents of the message referred to by mp (using the
copyb(9F) function). It returns a pointer to the new message.
RETURN VALUES
If the copy is successful, copymsg() returns a pointer to the new message. Otherwise, it returns a NULL pointer.
CONTEXT
copymsg() can be called from user or interrupt context.
EXAMPLES
Example 1: : Using copymsg
The routine lctouc() converts all the lowercase ASCII characters in the message to uppercase. If the reference count is greater than one
(line 8), then the message is shared, and must be copied before changing the contents of the data buffer. If the call to the copymsg()
function fails (line 9), return NULL (line 10), otherwise, free the original message (line 11). If the reference count was equal to 1, the
message can be modified. For each character (line 16) in each message block (line 15), if it is a lowercase letter, convert it to an upper-
case letter (line 18). A pointer to the converted message is returned (line 21).
1 mblk_t *lctouc(mp)
2 mblk_t *mp;
3 {
4 mblk_t *cmp;
5 mblk_t *tmp;
6 unsigned char *cp;
7
8 if (mp->b_datap->db_ref > 1) {
9 if ((cmp = copymsg(mp)) == NULL)
10 return (NULL);
11 freemsg(mp);
12 } else {
13 cmp = mp;
14 }
15 for (tmp = cmp; tmp; tmp = tmp->b_cont) {
16 for (cp = tmp->b_rptr; cp < tmp->b_wptr; cp++) {
17 if ((*cp <= 'z') && (*cp >= 'a'))
18 *cp -= 0x20;
19 }
20 }
21 return(cmp);
22 }
SEE ALSO allocb(9F), copyb(9F), msgb(9S)
Writing Device Drivers
STREAMS Programming Guide
SunOS 5.10 27 Jun 1995 copymsg(9F)