I need to make a list of some links on a web-page. I've been using right-click copy link URL and then pasting it (Menu_Edit->Paste) into vim running in xterm -- then repeating. This is obviously a rather cumbersome approach, and surely there must be a better way. (The pasting goes fine, so I guess the links are stored as ascii-text.)

So is there a way to automatically "record" each copy link URL (onto the clipboard) to a file - Ie. copying each change in the clipboard to a file? Is there a program that can do this, or perhaps some hidden file (eg. a named pipe) from which I could read the clipboard content?

I see there are some "clipboard managers"... are any of them suited to do something like this? (which one? how?)

I'm using LinuxMint MATE.

  • Try asking a question, about extracting links from web pages. It may be easier to use a command line web page fetcher such as wget or curl. – ctrl-alt-delor Aug 25 '14 at 14:23
  • There are already recorded into the clipboard, you just have to get them out. – ctrl-alt-delor Aug 25 '14 at 14:29

You could do something like:

while xclip -o -sel c && echo; do
  xclip -i -quiet -sel c <> /dev/null >&0 2>&0
done > file

xclip -o -sel c dumps the content of the CLIPBOARD selection. xclip -i -quiet -sel c claims ownership of the CLIPBOARD selection (and makes it empty) until something else claims it again. If you have a clipboard manager running, you may want to disable it as it would probably interfere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.