Loop with sed command to replace line with sed command in it
Okay, title is kind of confusion, but basically, I have a lot of scripts on a server that I need to replace a ps command, however, the new ps command I'm trying to replace the current one with pipes to sed at one point. So now I am attempting to create another script that replaces that line.
Line in the many scripts I'm trying to replace:
I'm trying to replace that with:
Here is the script I have:
I get this error with the above script:
Obviously I get it over and over again b/c I'm doing it in a loop.
I was also trying this with perl, and the one line of perl that I was trying was:
With the perl line I get this error:
I have no real preference as to which way to get it working, just that I need to get it working and have been stuck for quite some time now.
Hello,
I have a file and in that, I want to search for a aprticular word and then replace another word in the same line with something else.
Example: In file abc.txt, there is a line
<host oa_var="s_hostname">test</host>
I want to search with s_hostname text and then replace test with... (2 Replies)
I have a file with just over 1 million lines. I am trying to write a script that will find 1400 instances of two particular patterns and insert a url on the 22nd line after the second pattern is matched. Each line in the text file corresponds to a particular check box or dropdown in the software... (3 Replies)
Hi,
I have been trying to replace the key word
"SQL> spool off "
with
"/
show errors"
with out double quotes in all the files in a directory.
above show erros should be displayed next line
Could you please help me how to do that.
I have tried something like this... (3 Replies)
hi I am trying to use SED to replace the line matching a pattern using the command
sed 'pattern c\
new line
' <file1 >file 2
I got two questions
1. how do I insert a blank space at the beginning of new line?
2. how do I use this command to execute multiple command using the -e... (5 Replies)
Hi Gurus,
I did an exhaustive search for finding the script using "sed" to exclude the first line of file during find and replace.
The first line in my file is the header names.
Thanks for your help.. (4 Replies)
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)
Hi Expert,
I am working on one script which needs to read the input from the file and replace the words using sed command. For each line in the input file It should create one file. Below is the code. I can see the for loop is working fine but instead of three files it is creating one file
... (3 Replies)
Hi,
I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :-
./sample.sh: line... (12 Replies)
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)