LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-14-2014, 06:16 PM   #1
khronosschoty
Member
 
Registered: Jul 2008
Distribution: Slackware
Posts: 648
Blog Entries: 2

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
Copy desered text from clipboard and store in a structured history


Okay so I want to be able to copy text from clipboard, I know words will always be the same at the start of the desired text I wish to extract from the clipboard, and I know what the end text will be. I want to extract this text and everything in-between it and save it in a history.

Can anyone give me tips or an example of how this might be done? I wan t to do this, if at all possible, using the tcl programing language, but I'm sure that if someone gives me an example say in python or something like this I could translate it over.
 
Old 12-15-2014, 10:45 AM   #2
/dev/random
Member
 
Registered: Aug 2012
Location: Ontario, Canada
Distribution: Slackware 14.2, LFS-current, NetBSD 6.1.3, OpenIndiana
Posts: 319

Rep: Reputation: 112Reputation: 112
This is simple to do in C/C++

Just open a file, and in a while loop (while file is not eof) just use getline and set delimiters (eg the first and last line) in a if loop inside it just put contune, that (else) do something witht he rest of the data...

it's actually very easy.
 
Old 12-15-2014, 11:33 AM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by /dev/random View Post
Just open a file
file != clipboard

The easiest way to access the clipboard is probably by executing and reading output from an existing program that can do it, eg xclip. Else you would need to look at xlib or xcb bindings.
 
Old 12-15-2014, 11:42 AM   #4
/dev/random
Member
 
Registered: Aug 2012
Location: Ontario, Canada
Distribution: Slackware 14.2, LFS-current, NetBSD 6.1.3, OpenIndiana
Posts: 319

Rep: Reputation: 112Reputation: 112
Quote:
Originally Posted by ntubski View Post
file != clipboard

The easiest way to access the clipboard is probably by executing and reading output from an existing program that can do it, eg xclip. Else you would need to look at xlib or xcb bindings.
No its not, but the same princiles apply, open the data for reading and loop through it between 1 defined delimitor and another and in the process either map that data to something else or store it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Solaris 10 : Command to copy text to the clipboard. droopy4u Solaris / OpenSolaris 2 09-21-2014 08:00 AM
[SOLVED] How do I copy to the clipboard one large text file xmrkite Linux - Software 1 12-04-2012 03:41 PM
[SOLVED] Will gawk extract bits of text fields from a few thousand identically structured file taskmaster Linux - Software 4 11-10-2010 08:46 PM
Copy to 'clipboard' from shell anth0ny5 Linux - Newbie 9 04-08-2010 01:19 PM
Copy to Clipboard rubadub Programming 5 02-11-2008 02:39 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration