You are not logged in.
I have a small script that (among other things) reads text from a file and puts it in the primary clipboard using xclip. Problem is, there is an extra newline character (or at least I think that's what it is) which is appended to the selection which causes problems when pasting into a terminal. I can't get rid of it and I don't know where the problem is!
The offending line is as simple as:
cat $FILE | xclip
Where $FILE definitely does not contain a newline. I tried all sorts of sed filters before I remembered that sed only works on one line at a time, then I tried using head, and finally I gave tr a shot to restrict the characters that go through. Nothing has worked so far. Help?
Last edited by fflarex (2009-06-13 20:46:39)
Offline
You can try something like:
echo -en $FILE | xclip
Offline
Except that echo takes strings for arguments, not files.
Offline
Solved it by piping through this first:
tr -d '\n'
Offline
I tried using head
Including "cat <file> | head -n -1 | xclip"?
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
I didn't use head like that, but I tried it just now and all it did was clear my selection (or copy a null character, or something like that).
Offline
Hmmm, maybe it needs to be "-n-1", or "--lines=-1".
Meh, whatever, you've already found a working solution.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline