${NEW_ENDPOINT} has / inserted in it and when it gets expanded sed sees s/eai.endpoint.url=*/eai.endpoint.url=http://www.endpoint.com/API/g
The slashes in the URI gets confused with the delimiters.
Escaping them in the variable assignment might work as intended.
There is a subtle issue as well.
The * is a pattern matching for the shell and it gets interpreted by it. This variable might end up having assigned the name of every file in the directory that would match that. Furthermore, if it makes it as just a string, when it gets converted as a regex in sed, it only means match the following chars: eai followed by any char except the newline followed by endpoint(these are individual chars), followed by any character except the newline, followed by url, followed by one or many = or none.
means find all lines starting with eai.endpoint.url=
As it is your regex means something different: First, "." means "any single character", and "*" means "the preceding expression or single character is optional". Your regex therefore means:
"eai", followed by any single character, followed by the fixed string "endpoint", followed by any single character, followed by "url" and optionally a "=" at the end. This string, for instance: "eaiXendpointYurl" would match your regex.
This here would do what you want (note the difference between "." - any character - and "\." - a literal dot. Further, as you said the string you search for is at the beginning of the line, i added a "^" as anchor. It symbolizes the beginning of line):
It is probably easier to write your replacement like this (you won't need the final ".*"):
or, using the variable names you used - note the quoting:
I have a large dataset with following structure;
C 0001 Carbon
D SAR001 methane
D SAR002 ethane
D SAR003 propane
D SAR004 butane
D SAR005 pentane
C 0002 Hydrogen
C 0003 Nitrogen
C 0004 Oxygen
D SAR011 ozone
D SAR012 super oxide
C 0005 Sulphur
D SAR013... (3 Replies)
Hi
This is my first post and I'm just a beginner. So please be nice to me.
I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file?
I have tried sed -n 241,241p... (13 Replies)
Here is the task that I was presented with:
I am dealing with about a 10,000 line input deck file for an analysis. About 10 separate blocks of around 25 lines of code each need to be updated in the input deck.
The input deck (deckToChange in the code below) comes with 2 separate files. File 1... (5 Replies)
Dear all,
I would like to delete even lines starting with "N" together with their respective titles which are actually odd lines.
Below is the example of input file. I would like to remove line 8 and 12 together with its title line, i.e., line 7 and 11, respectively.... (2 Replies)
Hey,I have a file in following format
>1
ABC........
>2
XYZ.....
>3
ABC........
>4
MNO.......
>5
ABC.......
now I would like to find only those entries that doesn't start with ABC (specific pattern)e.g preferred output:
>2
XYZ....
>4
MNO.......
it will be nice if anybody how... (2 Replies)
Hello people,
I'm scratch my head to find a solution to my problem, I'm absolutely sure this is very simple!!! :wall:
I'm using the tcpdump to show on the screen in real time the UCP traffic:
tcpdump -l -i bond1 -s 1514 -nntttt -A src or dst 192.168.1.5 and port 10000 | egrep "/51/"The output... (5 Replies)
I have a txt file having rows and coulmns, i want to perform some operation on a specific coulmn starting from a specific line.
eg:
50.000000 1 1 1
1000.00000
1000.00000
50000.000
19
19
3.69797533E-07 871.66394 ... (3 Replies)
1. The problem statement, all variables and given/known data:
I have two files created from extracting data off of two CSV files, one containing class enrollment on a specific quarter and the other containing grades for that specific quarter. The Enrollment file generated contains course name,... (11 Replies)
hi,
i currently have a file with columns similar to this
customer name owed
CID123 John 300
CID342 harry 500
at present i use use awk to find the amount owed by the customer using the customer ID (CID).
if the customer spends more money how would i go about using sed/awk etc to... (2 Replies)
Hi Friends,
Following is an output of a script
OPWQERIUTYKLSADFJHGXZNMCVBWQOPERIUTYKLSADFJHGXZNMCVB
I want to replace above string's 11 to 17 character by ******* (7 stars)
How can it be done?
Please somebody guide me. (6 Replies)