In this article I'm going to share a simple bash function that makes dealing with system clipboard easier:
It automatically determines whether it's supposed to output the current clipboard or overwrite the clipboard based on its location in the pipeline:
clb | rg '^//' # Search clipboard for comments cat program.cc | rg '^//' | clb # Copy all comments in a file
It will open the clipboard content in your
EDITORif invoked as clb e. Clipboard will be updated when you exit the editor.