Jump to content

Text File Checker


Recommended Posts

Hey =)

i need some help. My problem/what i want:

A program that checks every line's ending for ".php" and if it ends with ".php"

the program writes the line to a second text file.

Example: I have a textfile with this inside:

www.google.com

www.google.com/index.php

www.youtube.com

www.youtube.com/login.php

Now i run the autoit program , and it check everyline for the ending ".php".

Now it writes every of those lines to a text document and it will look

like this:

www.google.com/index.php

www.youtube.com/login.php

Thats what it should do...

Anyone know how to make such a program?

Thanks in advance & best regards

Edited by zocker30
Link to comment
Share on other sites

$re = StringRegExp(ClipGet(), '(.*.+php)', 3)
For $i = 0 to UBound($re) -1
ConsoleWrite($re[$i] & @LF)
Next

Try this when you have somthing in your Clipboard.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

These three functions could be used. This is just a slightly different (and much more basic) way than the snips already provided of accomplishing your objective.

FileReadLine

StringRight

FileWriteLine

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Local $a_PHP = StringRegExp(FileRead("C:PathSomefile.txt"), "(?m:^)(.*.php)(?:v|$)+", 3)
If NOT @Error Then
$hFile = FileOpen(@DesktopDir & "results.txt", 2)
$s_Txt = ""
For $i = 0 To Ubound($a_PHP) -1
         $s_Txt &= $a_PHP[$i] & @CRLF
Next
FileWrite($hFile,StringStripWS( $s_Txt, 2))
FileClose($hFile)
EndIf

Edit: Forgot to add the @CRLF and then strip the last one for the write.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Local $a_PHP = StringRegExp(FileRead("C:PathSomefile.txt"), "(?m:^)(.*.php)(?:v|$)+", 3)
If NOT @Error Then
$hFile = FileOpen(@DesktopDir & "results.txt", 2)
$s_Txt = ""
For $i = 0 To Ubound($a_PHP) -1
         $s_Txt &= $a_PHP[$i] & @CRLF
Next
FileWrite($hFile,StringStripWS( $s_Txt, 2))
FileClose($hFile)
EndIf

Edit: Forgot to add the @CRLF and then strip the last one for the write.

Works perfect ! Thanks alot :DDD
Link to comment
Share on other sites

Glad it helped.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...