1
0
Fork 0

Update TIKHTG with basic sed stuff

main
will 1 year ago
parent a5f30b7066
commit 1a194446d6

@ -34,7 +34,7 @@
<h2>Binding things to just the Super key in KDE</h2>
<ol>
<li>Bind it to some other keyboard shortcut using KDE's typical GUI methods. Any shortcut will do.</li>
<li>Find the entry for it in <code>~/.config/khotkeysrc</code>. There should be a line that looks like: <code>Uuid=<u>{77575b17-36d6-4b4e-b01f-2f1156e38583}</u></code>. Copy the contents of that line, specifically everything I have underlined there.</li>
<li>Find the entry for it in <code>~/.config/khotkeysrc</code>. There should be a line that looks like: <code>Uuid={77575b17-36d6-4b4e-b01f-2f1156e38583}</code>. Copy everything inside the curly braces, including the braces themselves.</li>
<li>Run the following commands:</li>
</ol>
<code>$ kwriteconfig5 --file ~/.config/kwinrc --group ModifierOnlyShortcuts --key Meta "org.kde.kglobalaccel,/component/khotkeys,org.kde.kglobalaccel.Component,invokeShortcut,&lt;YOUR UUID HERE&gt;"<br>$ qdbus org.kde.KWin /KWin reconfigure</code>
@ -55,12 +55,21 @@
<tr><td><code>"te$(command)xt"<br>"as$((math))df"</code></td><td>Both can be inserted into strings.</td></tr>
<tr><td><code>"some&nbsp;$variable&nbsp;text"<br>"more${variable}text"</code></td><td>Both of these are valid ways to insert a variable into a string.</td></tr>
<tr><td colspan="2"><h4>grep</h4></td></tr>
<tr><td><code>-v</code></td><td>inverts it, so matches are excluded</td></tr>
<tr><td><code>-E "/regex/"</code></td><td>lets you use regex</td></tr>
<tr><td><code>-v</code></td><td>Inverts it, so matches are excluded</td></tr>
<tr><td><code>-E "/regex/"</code></td><td>Lets you use regex</td></tr>
<tr><td colspan="2"><h4>cut</h4></td></tr>
<tr><td><code>-d 'string'</code></td><td>determines the delimiter string</td></tr>
<tr><td><code>-f n</code></td><td>specifies a field to output, delimited by <code>-d</code></td></tr>
<tr><td><code>-d 'string'</code></td><td>Determines the delimiter string, the default is the TAB character</td></tr>
<tr><td><code>-f n</code></td><td>Specifies a field to output, delimited by <code>-d</code></td></tr>
<tr><td><code>sed 's/ */ /g' | cut -d ' '</code></td><td>Piping your thing through this <span title="It's not foolproof, though. Make sure you understand what this is doing so you can adapt it if it breaks.">helps</span> with parsing a lot of Linux commands that output tabular data</td></tr>
<tr><td colspan="2"><h4>sed</h4></td></tr>
<tr><td><code>sed "s/regex/replacement/flags"</code></td><td>The basic sed replacement command, checks a line of input against the provided regular expression <code>regex</code> and replaces matches with <code>replacement</code>.</td></tr>
<tr><td><code>sed "s/a/b/;s/c/d/"</code></td><td>Multiple sed commands can be strung together in one, like so.</td></tr>
<tr><td><code>sed "s/a/b/g"</code></td><td>The <code>g</code> flag makes sed replace all occurences of the pattern, not just the first</td></tr>
<tr><td><code>sed "s/a/b/&lt;number&gt;"</code></td><td>Insert any number to tell sed to replace only that occurence. Counts from 1. Theoretically, <code>s/a/b/</code> is the same as <code>s/a/b/1</code>.</td></tr>
<tr><td><code>sed "s/a/b/i"</code></td><td>GNU extension - Match case-insensitively.</td></tr>
<tr><td><code>sed "s/^a/b/"</code></td><td>Require that a match be at the beginning of the line.</td></tr>
<tr><td><code>sed "s/a$/b/"</code></td><td>Require that a match be at the end of the line.</td></tr>
<tr><td><code>sed "s/^a$/b/"</code></td><td>Require that a match be both at the beginning and the end - in other words, require that a match be the entire line.</td></tr>
<tr><td colspan="2"><h4>misc</h4></td></tr>
<tr><td><code>xrandr --output &lt;display name&gt; --brightness &lt;brightness&gt;</code></td><td title="It would definitely for sure be better to change this via the monitor's built-in menus, but that requires navigating both of my monitors' built-in menus.">Janky software-side display brightness setting with xrandr</td></tr>
<tr><td><code>wget "https://example.com/file.zip" -O temp.zip; unzip temp.zip; rm temp.zip</code></td><td>Bash one-liner to unzip a file from the internet to the current directory</td></tr>

Loading…
Cancel
Save