Skip to content
Advertisement

Tag: sed

Comments in sed command file

Can I put comments (or something functionally equivalent) into a sed command file? subs.sed Answer Yes, comments can be added to a sed file using #. From the manual page of sed: Command Synopsis … The comment extends until the next newline (or the end of a -e script fragment).

Using sed regex for string replacement

I am trying to replace a string in the config file. I would like to run something like this: OS (docker image php:8.1-apache-buster) Debian GNU/Linux 10 (buster) sed (GNU sed) 4.7 Packaged by Debian Possible inputs: Example output (any user given value): Example cmd: Joining regex with strings does not work here. It works when I run string replace without

parsing ethtool command output using sed and awk

I am working on a shell script to parse the advertised mode and supported mode from the ethtool command and match them against an expected value. The idea is both expected and supported modes should have a common value to pass the condition. Data: I have currently used the below for the same. The above code is giving the correct

insert a line with file which has sed command in linux

I am trying to insert line in a file which will have a sed command to insert a line in another file Like below for eg : want to add this line sed -i ‘1s/^/insideFilen/’ secondFile.sh to 65th line of firstfile.txt I tried: but not able to escape the ‘ also tried but got sed: -e expression #1, char 18:

Need help in regular expression using sed

I have following code:- The code works. When the status is one of the among (done, completed or closed) then it prints “Found valid Jira”. I want the “Not In” condition of it i.e. whenever the status comes out to be any of these then it should say “Found valid Jira”. Jira details response that I get is as follows:-

Updating a yaml with a string containing special characters using sed

I have a yaml file that needs to be updated with string containing special characters. Here is the command I used but I get sed expression error Yaml file (file): Command that works without special characters for $var (env variable): Value for $var: fkugoiuhoiuyflkbbui/qy++bfv7J3c Error I get is: I am trying to figure out how I can get this working.

Merge sed commands into a script

I need to write these two sed commands in a single script. I selects lines in range from 10 to 20 and prints them in a reverse order Could anybody please help me with this? Answer This seems to be working

Advertisement