Linked Questions

1 vote
1 answer
1k views

using sed for replacing strings with "/" [duplicate]

need to replace < network> with a "192.168.61.0/24" but i am not able to do it with sed, tried sed -i s/"< network>"/"192.168.61.0/24"/g file.sh but this is not working
kevin's user avatar
  • 105
-2 votes
3 answers
843 views

How to remove forward slashes from file in unix shell using sed? [duplicate]

I have the following file : / /FUSE // Bank S.A / N.V /F I want to remove all forward slashes (/), so that the result looks like this: FUSE Bank S.A N.V F How to do so using sed? Ive tried using ...
Nadia Alice's user avatar
-1 votes
1 answer
1k views

sed does not replace a string in a file as expected [duplicate]

I want to make replace a string in a file mytest.properties but it is not getting replaced. I want to replace JaWov5Svh/GKAkk8siezbg== and use the command $ sed -i -- 's/JaWov5Svh/GKAkk8siezbg==/...
Chintan's user avatar
  • 69
-1 votes
1 answer
562 views

sed: -e expression #3, char 59: unknown option to `s' [duplicate]

I am writing a script to replace three lines for input in a C++ code.This is the snippet of the C++ code whose inputs I want to change: char outputFileName_ForBlueEdge[50] = "...
thecep1's user avatar
  • 31
0 votes
1 answer
755 views

Using SED to remove specific line in a conf file [duplicate]

Im running against the wall in this command.. I want to remove the line: include "/etc/nginx/software.conf"; from the file called website. I've tried: sed -ri '/include \"/etc\/nginx\/...
Morten Jørgensen's user avatar
1 vote
1 answer
69 views

Finding and replacing text with sed [duplicate]

I am trying to use sed to find a replace "Host" with "Europe/London", however it is failing as shown below: # sed -i -e 's/"Host"/"Europe/London"/g' /usr/local/...
user12207241's user avatar
2 votes
1 answer
55 views

Add new line to a file contains < [duplicate]

i am trying to add a new line to a file using sed : sed -i '/<field name="Users" indexed="true"/>/a <copyField source="New_user" dest="text"/>' $RTDIR/schema.xml i get an error: unknown ...
twitcolny's user avatar
0 votes
1 answer
46 views

How can I replace a string with a string that contains a special character, using sed [duplicate]

For example replace keystore=". with keystore="./
patelpkd's user avatar
0 votes
0 answers
44 views

sed not reading directory information [duplicate]

I'm having problems with sed. I can't seem to get this to work. I have a data file (renegade.dat), which contains the following lines: /opt/rg/data/ /opt/rg/misc/ /opt/rg/menu/ /opt/rg/logs/ /opt/rg/...
ignatius's user avatar
  • 401
1 vote
0 answers
27 views

Unix replace all lines in a file starting with a string,by a variable [duplicate]

I have a requirement to replace all the lines in a file that start with a certain string to be replaced by a variable. Contents of te file - SDI=/u05/rdbms/admin NONSDI=/u07/rdbms/admin1 ...
neha dhawan's user avatar
2 votes
2 answers
1k views

Sed find and replace with slashes

I am having trouble using sed find/replace with slashes in the find parameter. Sample contents of test.sh str=$(sed -n '/^user:/p' /tmp/shadowtest) # find "user:" line in /etc/shadowtest arr=(${str//...
kenster89's user avatar
0 votes
2 answers
436 views

Insert command line information into the specified line of the file

source file: $cat test.file aaa bbb ccc I want to insert echo test> /var/tmp/file into the second line, and the desired result is like this: $ cat test.file aaa echo test > /var/tmp/file bbb ...
HUA SU's user avatar
  • 3
0 votes
2 answers
589 views

How to espace sequence of characters in sed?

I am new to regex and running into some frustrations. I am trying to work with strings that express directories and am having the issue reproducible by running: echo "a" | sed "s/a/home/...
Lara's user avatar
  • 63
0 votes
2 answers
293 views

replacing part of find output in a readarray command

I need to create filelist (playlist) for using it in a Docker container. So the path of the file on the host system is not the mounting path. Now I try to fix this, but I have some trouble. This is my ...
Gen-Chan's user avatar
0 votes
2 answers
252 views

double quote inside variable in Sed

Update Thanks @steeldriver for the answerd, the problem doesn't the double quote is the / only i needeed remplace for | Currently I have some problems with the sed command, I try to replace a string ...
David Hackro's user avatar

15 30 50 per page