Hot answers tagged

3

I'm pretty sure your issue is with the regexp. You'll need to move the lookahead assertion in front of the wildcard in order to only match lines that do not end in discard. For example, ^(?!.* discard$)(.*)$. Once you make that change you'll have an additional problem in that empty lines will match too -- probably undesirable. Use something like ^(?!.* ...


3

Escaping special char / is an option. You can also change the default sed separator (which is /) by using ? for example : another_unix_path="/another/unix/path" echo /some/path/file.txt | sed -e 's?/some/path/file.txt?'$another_unix_path'?g' The char used just after the s flag defines which separator will be used : s? Edit : #!/bin/sh basepath=/another/...


2

For temporary solution, here the regex for header_checks /^(Subject:)(.*)(.{2})$/ REPLACE $1$2 In above, (.{2}) will match last two character in your subject header. For more information about that syntax click this regex101 page.


2

After reading much documentation found out what I had done wrong. I had broken everything by manually adding the new Cert to IIS myself on the RDWeb server. No idea why this broke everything. The correct method apparently is to just add the Certificate to the Deployment Configuration via Server Manager (to each of RDWeb, Gateway, Broker etc) and this auto-...


1

This will do it: sed -r "s/(\s*.*db_host =* *').*('.*)/\1$MYSQL_HOST\2/" your_file The ways it's working is as follows: I remember the stuff in between the above using ( and ) Specifically I remember up to and including the first single quote and also everything after and including the second single quote. So we remember all by the localhost bit. ...


1

First, I don't know what all your quotes are for. Just put one set of quotes around the substitution command. You use slashes to delimit regular expression and replacement string in the sed command. ReplaceeVar contains lots of slashes as well. The resulting command is sed -i "s/Change_This_Url/http://localhost:1234/ab/cd/{company}/{employee}//g" &...


1

Your last step is unclear to me. I think you have moved your data from btrfs array A to B. You used to mount the directory with UUID=0888211b-2636-4eb5-97da-52679d93a275 /srv btrfs subvol=/@/srv 0 0 So you should replace this line in /etc/fstab with uuid=273dbdbd-16d9-4ae4-bde7-d30a48474a44 /srv btrfs subvol=/@srv 0 ...


1

Does a sed script like this work for you? $ cat filter.sed s|\([0-9]\+\.\)\([0-9]\+\.\)\([0-9]\+\.\)\([0-9]\+\)|___\1___\2___\3___\4|g s|___[0-9]|___X|g s|___X[0-9]|___XX|g s|___XX[0-9]|___XXX|g s|___||g Here is an example run, $ echo "111.22.3.44" | sed -f filter.sed XXX.XX.X.XX This is going to convert all IP addresses of the form a.b.c.d into ...


1

Ah, the "!" was fine, it was the failure of the "share_name" variable to translate. Use double rather than single quotes in this command. sed "/\${share_name}\]/,/^$/{/[${share_name}\]/n;/^$/!s/writeable/\#writeable/g}}" \ < ${input_file} \ > /tmp/parse-smb.tmp Should have realized that the subsequent line also used double quotes. sed -i "s/\[${...


1

Almost there, thanks to this list and http://fahdshariff.blogspot.com/2012/12/sed-mutli-line-replacement-between-two.html. I am able on the command line to replace the "writeable" with "# writeable" and can do so without regard to the Y/N setting, I insert another line later on. sed '/\[${share_name}\]/,/^$/{/\[${share_name}\]/n;/^$/!{s/writeable/\#...


1

Well, holistically it's solvable by changing default qdisc, since mq does initialize it's leave to the default qdisc. So ... sysctl -w net.core.default_qdisc=<your_qdisc> tc qdisc replace dev <your iface> root mq An verifiy ... tc -s qdisc show <your iface> ens3 Though, individual setability would have it's charme. I might come round ...


1

If you use / for separators, then you'll have to escape every / in your path, ex sed 's/\/some\/path/'$replacement'/g' Fortunately sed - like Perl - allows many characters to be used as separators, so you can also write sed 's#/some/path#'$replacement'#g' (the g flag is used to allow replacing multiple occurrences per line). Also sed will not allow in-...


1

There are only 4 OS drives. Slots 0, 1, 2, & 3. The OS drives are mirrored. The procedure to replace one is to simply pull the faulted drive and put the new one in. It will automatically start rebuilding and mirror back to that drive. If I remember correctly, drive 0 is mirrored to 2 and 1 is mirrored to 3.


1

find has an -mtime filter you can use for that. For more elaborate search-and-replace, you can also use a shell loop. find WHATEVER | while read f ; do ## add your own test here, like … # fgrep -qs "do not delete" "$f" && continue cp -f /what/ever "$f" done For supplying find with exact dates, use something along the ...


1

You now might have cases with <p></p> since you've replaced the &nbsp;s with empty strings.


Only top voted, non community-wiki answers of a minimum length are eligible