lang/awk/ RandomSnippets001


Colon-separated to table

This

pp | tr -d "\r" | awk -F: '/#/ { print; print "\n| What | Keys |\n| --- | --- |" } /^ *$/ { print; next; } !/#/ { print "| " $1 " | " $2 " |" }' | pc```
(where `pp` is a command that pastes from the clipboard, and `pc` is a command that pastes to the clipboard.
I have two scripts which call the appropriate programs based on the operating system and window system
in use at the time, e.g. X11 vs Windows vs Cygwin vs Macos)
turns this:
```markdown
### Basic DaVinci Resolve Shortcuts:
Cut: Ctrl/Cmd + X
Copy: Ctrl /Cmd + C
Undo: Ctrl/Cmd + Z
Redo: Ctrl/Cmd + Shift + Z

into this

### DaVinci Resolve Shortcuts for Views and Displays
| What | Keys |
| — | — |
| Zoom | to |
| Full-Screen | Viewer: |
| Cinema | Viewer: |
| Retime | Controls: |
| Loop/Unloop: | Ctrl/Cmd+/ |