←back to thread

2039 points Gadiguibou | 1 comments | | HN request time: 0s | source
Show context
klausa ◴[] No.36491947[source]
`pbcopy` and `pbpaste` are one of my most-loved in the list.

Dealing with some minified json, switching to iTerm, doing `pbpaste | json_pp | pbcopy` and having a clean output is _so_ nice.

replies(28): >>36492008 #>>36492015 #>>36492028 #>>36492101 #>>36492108 #>>36492229 #>>36492265 #>>36492890 #>>36492953 #>>36493037 #>>36493127 #>>36493336 #>>36493457 #>>36493802 #>>36494023 #>>36494242 #>>36494325 #>>36495379 #>>36495894 #>>36496866 #>>36497033 #>>36497293 #>>36497589 #>>36497973 #>>36498181 #>>36498558 #>>36498586 #>>36535798 #
inanutshellus ◴[] No.36492101[source]
I love this flow! Such a powerful and clean way to solve text issues.

    # This will remove Windows double-spaced empty lines from your copy/paste buffer
    alias winlines="sed '/^$/{$!{N;s/\n//;};}'"
    
    # pbw = [P]aste [B]uffer to fix [W]indows line endings
    alias pbw="pbpaste | winlines | pbcopy"
Also - if you want `pbpaste` and `pbcopy` on Linux...

    # imitate MacOS's paste buffer copy/paste:
    alias pbcopy='xsel --clipboard --input'
    alias pbpaste='xsel --clipboard --output'
replies(2): >>36492879 #>>36496613 #
computerfriend ◴[] No.36492879[source]
Here's the xclip way (almost the same actually).

    alias pbcopy="xclip -selection clipboard"
    alias pbpaste="xclip -selection clipboard -o"
replies(1): >>36493355 #
1. lordgrenville ◴[] No.36493355[source]
I use this, and another Mac affordance I copy in Linux is

    alias open="xdg-open"