By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,321 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,321 IT Pros & Developers. It's quick & easy.

print txt files pages which contain Word

P: 232
ours is very much printing Work We print txt files of about 50000 pages daily.After these printing We have to again print more than 1000 different page based on certain Word because there printing Was of bad quality.for example they order me to again print those page which contain Word eg. gold or form or pgno5 or pgno62.....etc .About 1000 reprint.I have to find those page manually by find option of notepad and cut them and paste in another file.the process take about 1000 find,1000 copy and 1000 paste.this takes very much time.Is there any easy method in any language to do that?i Will be very thank full to you
Feb 1 '12 #1
Share this Question
Share on Google+
5 Replies

P: 70
Yes, with a bit of effort this could be achieved, a theoretical method for achieving this would be to have each file you want to sort through in a list, through this list a streamreader or other form of would be able to read each document, a simple find function would be able to determine if it contains the searched word, if it does then that document should be automatically entered into another list called print list or something, once every file has been iterated through looking for the word you gave it you would be able to run a loop where each file in the list of things to print would be printed, then boom you have yourself a piece of software which will search for a word you ive it, find the files and print the files and all you have to do is type the word and press go!
so yes it is possibble but i dont have the time to write that piece of software currently, im just providing the theory perhaps for someone who has the time but didnt know where to begin

EDIT: Actually just found this link, it nearly does what you want it to do, the answer by Henk Holterman has some crossed out lines but you need those, and isntead of deleting the file, just have it print instead! very little modification needed and you have yourself a useful little app!
Apr 13 '12 #2

Expert 5K+
P: 8,434
It would probably help if we had some idea what tools you have available. For example do you have a programming language of any sort that you could use to throw together a quick utility?

Also, is this one huge 50,000-page text file or 50,000 individual ones or what? If they're individual files you could use the Windows file-search tool to find all the ones containing your word, then do a bulk print of those files from the "search results" folder.
Apr 22 '12 #3

P: 70
almost got this done, you type in a word and press go, it searches through a folder containing each file, if it contains that word anywhere in the document it moves it to a results folder, (which is excluded from the search to avoid infinite loops) from there you can just do a bulk print like suggested above
Apr 24 '12 #4

Expert 5K+
P: 8,434
That's what the built-in Windows search facility does. As far as I can see, the only reason to write such a utility is "because I can" (which is a damn good reason, of course).

The details might be slightly different if you're actually moving the documents, as stated. Windows search just temporarily creates shortcuts to them.
Apr 29 '12 #5

P: 70
windows search doesnt check the contents of each file, just its name when you do a search doesnt it?
Apr 29 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.