pongmaster21 Posted October 11, 2006 Share Posted October 11, 2006 Is there a way to use the fileread command to read a particular line of text then return the line number. In the case of the text below, I would like a command to find "[daterange]" then return a line number in that file. Then I can take the line number and add one to use the FileReadLine("filename", line) command to effectively read the next line of text which is the actual date range. [daterange] 18000101-20380101 ; Link to comment Share on other sites More sharing options...
GaryFrost Posted October 11, 2006 Share Posted October 11, 2006 Is there a way to use the fileread command to read a particular line of text then return the line number. In the case of the text below, I would like a command to find "[daterange]" then return a line number in that file. Then I can take the line number and add one to use the FileReadLine("filename", line) command to effectively read the next line of text which is the actual date range. [daterange] 18000101-20380101 ; You might try _FileReadToArray instead of filereadline, then just search the array SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 11, 2006 Moderators Share Posted October 11, 2006 (edited) I agree on the array, but for sh**s and giggles, I decided to try this (will work only if it's the first word of the line you are looking for):$Fread = StringStripCR(FileRead(@DesktopDir & '\MyOwnWorkBreather.txt')) StringReplace(StringLeft($Fread, StringInStr($Fread, @LF & '[daterange]')), @LF, '') If @extended Then MsgBox(64, 'Info', 'Found on line: ' & @extended + 1) Edit: File Content:18000101-20380101 18000101-20380101 ; 18000101-20380101 ; [daterange]18000101-20380101 ; 18000101-20380101 ; Edited October 11, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
pongmaster21 Posted October 11, 2006 Author Share Posted October 11, 2006 In the case of the text below I would like to open the text file and search for the text string "Number of marc records processed: " then extract the rest of the line.Can autoit do something like this?Building catalog file To : Tue Oct 10 16:08:24 2006Time Elapsed : 0 hr. 5 min. 23 sec Number of marc records processed: 350054 Largest input marc record: 12936 Largest input marc data size: 12501 Largest uncompressed data portion: 11776 Fields with no entry in the DDF: 6163876 Largest output marc record size: 12936 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now