Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 4 years ago. Improve this question I have a text given below… Here i dont want string 0.00… from
Tag: sed
Fetch latest matching string value
I have a file which contains two values for initial… keyword. I want to grab the latest date for matching initial… string. After getting the date I also need to format the date by replacing / with – In the above example, my output should be 2018-02-05. Here, I am fetching the line which contains initial… value and only getting
sed pattern matching between lines
I am trying to write a sed script to only output the lines of a file if the line has the /pattern/ and is between line x and line y. I have the following: select.sed: If my text.file is the the following: The desired output would be How would I set a range for lines 2-4 and only print values
Using sed – how to replace two HTML tags or patterns with unknown content in-between?
I want to leave the unknown content between tags intact, but want to match all tags that use: and replace the surrounding tags with: I’ve come up with the following, but obviously it’s not working as in the second part it’s literally substituting “].*[<]/h2[>]” for each match found. I’d like to specifically know how to leave that middle content intact,
How to find sequence of characters matching an identifier in Linux/Unix?
I have a fasta file called mytext.fasta. mytext.fasta When I do grep -A1 ‘SS1G_01082’ mytext.fasta, I get: Instead I want to get: If you notice, every sequence starts with > in this file, so I want to get the full length of sequence when I do grep. How can I get this done? Answer It is easier with gnu awk
Using sed with regex to match varying lines
I’m having some issues used sed to match a regex pattern. An example would be with the following lines: spring-core-4.0.0 should be spring-core-4.1.0 spring-web-4.0.0 should be spring-web-4.1.0 I want the regex to match any characters in between spring and the version number. I’m not sure if I need to do something else for sed to remember what those characters are
Unix – Replace column value inside while loop
I have comma separated (sometimes tab) text file as below: parameters.txt: with below code I try to loop through the file and do something I wanted to update the last column of the file to N if the above operation is successful, however below approaches are not working for me: sed ‘s/$f5/N/’ ‘$5==”Y”,$5=N;{print}’ $(echo “$line” | awk ‘$5=N’) Update: Few
Trouble writing bash sed command – regex match
I have a file full of garbage collection information that is irregular, some lines have extra information that I want to initially remove so I can then process the the file as a whole. Unfortunately the line has quite a few special characters and I am struggling with a sed command that manages to match the bit I want to
multi pattern in sed -n
I know there are quite a few questions asked on this topic. But I need help in a case basis.When i try to put more than 3 pattern in the option, i will get the error like that… i only want to print the words in the brackets.. here is the sed command and the output… thanks… sample output Answer
Using sed (or any other tool) to remove the quotes in a json file
I have a json file I want to change it to i.e. convert the requestId from String to Integer. I have tried some ways, but none seem to work : Could someone help me out please? Answer Try or The main differences with your attempts are: Your regular expressions were looking for [0-9] between double quotes, and that’s a single