Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. $ xsel -b | sed 's/^/ /' | xsel -b
  2.  
  3. # put two lines in the clipboard, "abc" and "123", for the example
  4. # the n is a newline, and echo adds another newline to the end
  5. $ echo $'abcn123' | xsel -b
  6.  
  7. $ xsel -b | sed 's/^/ /' # output written to the terminal
  8. abc
  9. 123
  10. $ xsel -b | sed 's/^/ /' | xsel -b # again, to the clipboard
  11.  
  12. #!/bin/bash
  13. xsel -b | sed 's/^/ /' | xsel -b
  14.  
  15. $ chmod +x indent4
  16.  
  17. # test it:
  18. $ echo $'abcn123' | xsel -b # load clipboard
  19. $ ./indent4 # assuming it's in the current directory
  20. $ xsel -b # show clipboard
  21. abc
  22. 123
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement