I have two variables, i want to replace ESX_10.2.3.4@10.52.33.21 with new pool ser/@10.25.89.322 and also want to remove space before new word. i have tried like, and I don’t want to delete space ,just want to replace as it is(except space before “new”). Answer Give a try to this: It is removing the space in the first occurrence of new
Tag: sed
Insert space between numbers after matching specific pattern [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago. Improve this question I have the following temperature data that needs to be manipulated. Thought about using sed to insert a space in
Comparing two files at end of line in Linux
I would like to compare two files and get the output of matching string in one of the files at the end of the line: Let’s say I have two files:- file1: file2: I could do something like this: This gives me the following output: This is because abcdef in file2 matches both of those lines in file1. However, what
How to get one line from a print output in linux?
I’m trying to pull one line from a subprocess.check_output but so far I have no luck. I’m running a Python script and this is my code: and this is what I get back when I run the script: Now I want to get the 9th line (RMS amplitude) out of this list. I already tried something with sed but it
Replacing strings with special characters in command line sed
I want to uncomment a line of a config file by replacing the line %% {some_string, []}, with {some_string, []} in the command line. I have tried a few different formats using sed: sed ‘s/%% {some_string, []},/{some_string, []}/’ filename sed “s/%% {some_string, []},/{some_string, []}/” filename sed “s/’%% {some_string, []},’/'{some_string, []}’/” filename sed ‘s/”%% {some_string, []},”/”{some_string, []}”/’ filename but every time
replace text between two tabs – sed
I have the following input files: and I am trying to find the second string between the two tabs (e.g. text2, abc2) and replace it with another word. I have tried with but it only deletes the tab and does not replace the word. I appreciate any help! Answer I would suggest using awk here: Set the input and output
Replace line with double quotes
I want to replace a line with double quotes on OpenBox startup, like: with I use this command, but it does not work: It gives me this error: Answer The ampersand in the replacement string recalls the pattern in the search string. So you can just do this: Also, you can use single quotes on the outside, and double quotes
how to replace [^u0009u000Au000Du0020-uD7FFuE000-uFFFDu10000-u10FFF]+ to “” in a file by sed or anything?
I find and replace some strange characters in xml file with text editor. with regular expression Now, I need to it in linux command line. I ask you how to use sed or anything that same find and replacement job in linux command line. Thank you in advance Answer You can try this : Before replacing, be sure you really
formatting the output with sed command
I need your help… I got this kind of text: and the output I need is (first and second column and socialSecurityNumber OR tng-customer-id): So the question is … is it possible to solve this issue with sed command? I need the OR option here. If I try to do it separately, firstly, find the socialSecurityNumber, I get this: secondly,
Shell substring with sed in a variable
I have tried this command in bash linux The output is value. But if I put it in a variable, it doesn’t work. For example: The output is nothing. What wrong? Answer Do it like this: