Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to replace # in particular line? Post 303042915 by yash_message on Friday 10th of January 2020 12:16:39 PM
Old 01-10-2020
Yes I tried, but below is the result, which is not exact result.


1. $ActionExecOnlyWhenPreviousIsSuspended on
command-
Code:
sed     's/^$ActionExecOnlyWhenPreviousIsSuspended/#$ActionExecOnlyWhenPreviousIsSuspended/' /etc/rsyslog.conf

Result- #$ActionExecOnlyWhenPreviousIsSuspended on - its done, and fine

2. &@@10.10.10.10
Command
Code:
sed 's/^&@@10.10.10.10/#&@@10.10.10.10/' /etc/rsyslog.conf

Result- #&@@10.10.10.10@@10.10.10.10 - its replacing "#", but its replacing wrong

3. & /var/log/localbuffer
Command- sed 's/^& /var/log/localbuffer/#& /var/log/localbuffer/' /etc/rsyslog.conf
Result- sed: -e expression #1, char 11: unknown option to `s'

4. $ActionExecOnlyWhenPreviousIsSuspended off
Command- sed 's/^$ActionExecOnlyWhenPreviousIsSuspended/#$ActionExecOnlyWhenPreviousIsSuspended/' /etc/rsyslog.conf
Result- #$ActionExecOnlyWhenPreviousIsSuspended off - fine its good

Only problem in 2 & 3 .
so, looking help on this only.

Last edited by RavinderSingh13; 01-10-2020 at 02:06 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to replace the first word of a line if it occurs again in the next line(shell)

Hi folks, have a look into the attachment, i am not familiar with unix, can you please help me in this regard. thanks in advance, :) regards, Geeko (4 Replies)
Discussion started by: geeko
4 Replies

2. Solaris

Line too long error Replace string with new line line character

I get a file which has all its content in a single row. The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file. I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies

3. Shell Programming and Scripting

sed to replace a line with modified line in same file

i have few lines in a file... i am reading them in a while loop so a particular line is held is $line1.. consider a modified line is held in $line2.... i want to replace $line1 with $line2 in the same file... how to do it..? i have come up till the below code sed "s/$line1/$line2/g" tmpfile.sql... (5 Replies)
Discussion started by: vivek d r
5 Replies

4. Shell Programming and Scripting

Find a line using a condition and replace a string in that line

Hello, I have a 100 line code. I have given a sample of it below: ABC*654654*1*54.54*21.2*87*1*654654654654 CCC*FS*FS*SFD*DSF GGG*FGH*CGB*FBDFG*FGDG ABC*654654*1*57.84*45.4*88*2*6546546545 CCC*WSF*SG*FGH*GHJ ADA*AF*SFG*DFGH*FGH*FGTH I need to select the line starting with "ABC" its... (6 Replies)
Discussion started by: nithins007
6 Replies

5. Emergency UNIX and Linux Support

Find a line using a condition and replace a string in that line

Hello, I have a 100 line code. I have given a sample of it below: ABC*654654*1*54.54*21.2*87*1*654654654654 CCC*FS*FS*SFD*DSF GGG*FGH*CGB*FBDFG*FGDG ABC*654654*1*57.84*45.4*88*2*6546546545 CCC*WSF*SG*FGH*GHJ ADA*AF*SFG*DFGH*FGH*FGTH I need to select the line starting with "ABC" its... (3 Replies)
Discussion started by: nithins007
3 Replies

6. Shell Programming and Scripting

I need to know how to replace a line after a pattern match with an empty line using SED

Hi How Are you? I am doing fine! I need to go now? I will see you tomorrow! Basically I need to replace the entire line containing "doing" with a blank line: I need to the following output: Hi How Are you? I need to go now? I will see you tomorrow! Thanks in advance.... (1 Reply)
Discussion started by: sags007_99
1 Replies

7. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

8. Shell Programming and Scripting

Multiple line search, replace second line, using awk or sed

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

9. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies

10. Shell Programming and Scripting

Replace values in script reading line by line using sed

Hi all, Let's say I have a script calling for the two variables PA_VALUE and PB_VALUE. for pa in PA_VALUE blah blah do for pb in PB_VALUE blah blah do I have a text file with two columns of values for PA and PB. 14.5 16.7 7.8 9.5 5.6 3.6 etc etc I would like to read this... (7 Replies)
Discussion started by: crimsonengineer
7 Replies
Net::Jabber::Dialback::Result(3pm)			User Contributed Perl Documentation			Net::Jabber::Dialback::Result(3pm)

NAME
Net::Jabber::Dialback::Result - Jabber Dialback Result Module SYNOPSIS
Net::Jabber::Dialback::Result is a companion to the Net::Jabber::Dialback module. It provides the user a simple interface to set and retrieve all parts of a Jabber Dialback Result. DESCRIPTION
To initialize the Result with a Jabber <db:*/> you must pass it the XML::Stream hash. For example: my $dialback = new Net::Jabber::Dialback::Result(%hash); There has been a change from the old way of handling the callbacks. You no longer have to do the above yourself, a NJ::Dialback::Result object is passed to the callback function for the message. Also, the first argument to the callback functions is the session ID from XML::Streams. There are some cases where you might want this information, like if you created a Client that connects to two servers at once, or for writing a mini server. use Net::Jabber qw(Server); sub dialbackResult { my ($sid,$Result) = @_; . . . } You now have access to all of the retrieval functions available. To create a new dialback to send to the server: use Net::Jabber qw(Server); $Result = new Net::Jabber::Dialback::Result(); Now you can call the creation functions below to populate the tag before sending it. For more information about the array format being passed to the CallBack please read the Net::Jabber::Client documentation. Retrieval functions $to = $Result->GetTo(); $from = $Result->GetFrom(); $type = $Result->GetType(); $data = $Result->GetData(); $str = $Result->GetXML(); @dialback = $Result->GetTree(); Creation functions $Result->SetResult(from=>"jabber.org", to=>"jabber.com", data=>key); $Result->SetTo("jabber.org"); $Result->SetFrom("jabber.com"); $Result->SetType("valid"); $Result->SetData(key); Test functions $test = $Result->DefinedTo(); $test = $Result->DefinedFrom(); $test = $Result->DefinedType(); METHODS
Retrieval functions GetTo() - returns a string with server that the <db:result/> is being sent to. GetFrom() - returns a string with server that the <db:result/> is being sent from. GetType() - returns a string with the type <db:result/> this is. GetData() - returns a string with the cdata of the <db:result/>. GetXML() - returns the XML string that represents the <db:result/>. This is used by the Send() function in Server.pm to send this object as a Jabber Dialback Result. GetTree() - returns an array that contains the <db:result/> tag in XML::Parser::Tree format. Creation functions SetResult(to=>string, - set multiple fields in the <db:result/> from=>string, at one time. This is a cumulative type=>string, and over writing action. If you set data=>string) the "from" attribute twice, the second setting is what is used. If you set the type, and then set the data then both will be in the <db:result/> tag. For valid settings read the specific Set functions below. SetTo(string) - sets the to attribute. SetFrom(string) - sets the from attribute. SetType(string) - sets the type attribute. Valid settings are: valid invalid SetData(string) - sets the cdata of the <db:result/>. Test functions DefinedTo() - returns 1 if the to attribute is defined in the <db:result/>, 0 otherwise. DefinedFrom() - returns 1 if the from attribute is defined in the <db:result/>, 0 otherwise. DefinedType() - returns 1 if the type attribute is defined in the <db:result/>, 0 otherwise. AUTHOR
By Ryan Eatmon in May of 2001 for http://jabber.org.. COPYRIGHT
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2004-08-17 Net::Jabber::Dialback::Result(3pm)
All times are GMT -4. The time now is 07:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy