←back to thread

2039 points Gadiguibou | 5 comments | | HN request time: 0.44s | source
1. 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 #
2. 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 #
3. lordgrenville ◴[] No.36493355[source]
I use this, and another Mac affordance I copy in Linux is

    alias open="xdg-open"
4. lozf ◴[] No.36496613[source]
There's `wl-copy` and `wl-paste` for Wayland users too, via https://github.com/bugaevc/wl-clipboard
replies(1): >>36497311 #
5. netr0ute ◴[] No.36497311[source]
And `cb` which works cross-platform, via https://github.com/Slackadays/clipboard