How to match a single quote in sed

You can either use: “texta’textb” (APOSTROPHE inside QUOTATION MARKs) or ‘texta’\”textb’ (APOSTROPHE text APOSTROPHE, then REVERSE SOLIDUS, APOSTROPHE, then APOSTROPHE more text APOSTROPHE) I used unicode character names. REVERSE SOLIDUS is more commonly known as backslash. In the latter case, you close your apostrophe, then shell-quote your apostrophe with a backslash, then open another apostrophe … Read more

How do you strip quotes out of an ECHO’ed string in a Windows batch file?

The call command has this functionality built in. To quote the help for call: Substitution of batch parameters (%n) has been enhanced. You can now use the following optional syntax: %~1 – expands %1 removing any surrounding quotes (“) Here is a primitive example: @echo off setlocal set mystring=”this is some quoted text” echo mystring=%mystring% … Read more

Remove part of path on Unix

If you wanted to remove a certain NUMBER of path components, you should use cut with -d”https://stackoverflow.com/”. For example, if path=/home/dude/some/deepish/dir: To remove the first two components: # (Add 2 to the number of components to remove to get the value to pass to -f) echo $path | cut -d”https://stackoverflow.com/” -f4- # output: # some/deepish/dir … Read more

tech