Substitutions inside Sphinx code blocks aren’t replaced
Use the “parsed-literal” directive. .. parsed-literal:: ./home/user/somecommand-|version| Source: https://groups.google.com/forum/?fromgroups=#!topic/sphinx-dev/ABzaUiCfO_8:
Use the “parsed-literal” directive. .. parsed-literal:: ./home/user/somecommand-|version| Source: https://groups.google.com/forum/?fromgroups=#!topic/sphinx-dev/ABzaUiCfO_8:
A substitution would work nicely. :%s/}/\0\r/g Replace } with the whole match \0 and a new line character \r. or :%s/}/&\r/g Where & also is an alternative for the whole match, looks a bit funny though in my opinion. Vim golfers like it because it saves them a keystroke 🙂 \0 or & in the … Read more
TL;DR: Since you are using Bash specific features, your script has to run with Bash and not with sh: $ sh myscript.sh myscript.sh: 2: myscript.sh: Bad substitution $ bash myscript.sh ffmpeg -i bar.mp4 bar.mp3 ffmpeg -i foo.mp4 foo.mp3 See Difference between sh and Bash. To find out which sh you are using: readlink -f $(which … Read more
Yes you are right, it removes the newline character. I think the purpose of the test is to make sure $dir doesn’t contain multiple lines. Alternatively, you can remove \newline by ${dir/$’\n’/} This doesn’t require two lines so I think it looks better.
Specifically for subsitutions: use & to repeat your last substitution on the current line from normal mode. To repeat for all lines, type :%&
I’d recommend using the BFG Repo-Cleaner, a simpler, faster alternative to git-filter-branch specifically designed for rewriting files from Git history. You should carefully follow these steps here: https://rtyley.github.io/bfg-repo-cleaner/#usage – but the core bit is just this: download the BFG’s jar (requires Java 7 or above) and run this command: $ java -jar bfg.jar –replace-text replacements.txt … Read more
On the replacement side, you must use $1, not \1. And you can only do what you want by making replace an evalable expression that gives the result you want and telling s/// to eval it with the /ee modifier like so: $find=”start (.*) end”; $replace=””foo $1 bar””; $var = “start middle end”; $var =~ … Read more
strip only removes characters from the beginning and end of a string. You want to use replace: str2 = str.replace(“\n”, “”) re.sub(‘\s{2,}’, ‘ ‘, str) # To remove more than one space
According to http://vim.wikia.com/wiki/Search_and_replace It appears: :%s/foo/\=@a/g Also, pressing <c-r>a while in insert mode will insert the contents of register a. Cool — I never knew that. Good question. Some other things to do with <c-r>: http://vimdoc.sourceforge.net/htmldoc/cmdline.html#c_CTRL-R
Variables inside ‘ don’t get substituted in Bash. To get string substitution (or interpolation, if you’re familiar with Perl) you would need to change it to use double quotes ” instead of the single quotes: # Enclose the entire expression in double quotes $ sed “s/draw($prev_number;n_)/draw($number;n_)/g” file.txt > tmp # Or, concatenate strings with only … Read more