Linux - Script to edit clipboard content -
is there way write script applied clipboard content ( i'm using linux\gentoo)?
when copy-pasting nice bind keystroke (e.g -) remove line breaks copied text.
i couldn't find start such task (where should such script placed\how reference clipboard) hint of start appreciated.
thanks!
you need install xsel
access clipboard. can use small script , piping. use prepend 4 spaces current selection in order version can paste stackoverflow editors:
xsel | while ifs='' read a; echo " $a"; done | xsel
default xsel
manipulate (or query) primary selection (what marked mouse). can use clipboard (c-c, c-v stuff) instead using option -b
.
to remove line breaks current clipboard, try this:
xsel -b | tr '\n' '\r' | sed 's/\r*//g' | xsel -b
Comments
Post a Comment