read file for a string and print the line to a file

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Davd K
Newbie
Posts: 7
Joined: Wed Jun 16, 2004 4:00 am

read file for a string and print the line to a file

Post by Davd K » Sat May 21, 2005 3:35 am

I want to ask for the string.
Search the file for that string.
If the string is located in the file, write the line to a new file.

Here is an example of a line in the file.
5/11/2005 8:20:21 PM Print Information None 10 NT AUTHORITY\SYSTEM PMLPRINT Document 436, Microsoft Word - owned by bkennedy was printed on 1E-08-HP1 via port IP_170.52.23.20-2. Size in bytes: 739836; pages printed: 1

I want to pull out the date, time, owner and number of pages printed and write it to a new file

How can I do this?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Sat May 21, 2005 7:26 am

Use ReadLn to read through the file and use MidStr, Position and Length commands to extract the strings.
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts