I need to parse some text from a log file and I was wondering what if there was a prefered scripting language for this. I need something that will grab timestamps, string processing, and do numerical operations, nothing too fancy.I know Java and PHP, but I was curious if anyone would think Perl, Python, Tcl, or C# would be better. Thanks.
9/10/2007 3:00:04 PM
Also FYI i will be developing and executing the scripts on Windows.
9/10/2007 3:01:24 PM
what's the project?out of curiosity.
9/10/2007 3:07:47 PM
perl
9/10/2007 3:16:52 PM
agree with Perl
9/10/2007 3:19:12 PM
perl </thread>
9/10/2007 6:01:17 PM
9/10/2007 6:11:34 PM
PerlThough realistically PHP can do everything you need and since you already know it, you might as well use it.
9/10/2007 6:16:36 PM
since it's windows and you know php, stick to that.Just install the CGI package, and go run it. I STILL use php for random command line scripting all the time in windows, it's really light-weight and powerful
9/10/2007 6:53:47 PM
perl is the traditional choice but i agree with those who say use php. you already know it, and it can do pretty much everything]
9/10/2007 7:10:32 PM
9/10/2007 9:12:26 PM
you'd have more fun with ruby
9/10/2007 9:27:59 PM
Agreed with stein, noen, and qntmfred.
9/10/2007 9:51:48 PM
perlits a good langauge to know and it excels at text parsing. Learning something new (and brushing up on regex's) is never a bad idea.
9/10/2007 10:04:21 PM
ruby
9/10/2007 11:38:04 PM
you can more than likely do what you need to do with regular batch commands, possibly with the addition of regular resource kits. if you exceed the limitations of batch, perl/awk/python would be my choice, mainly because I don't know php
9/11/2007 12:20:09 AM
Thats a retarded idea as he'd be doing the same amount of work writing 10 lines of batch and pipe commands as 10 lines of perl.I would use Perl, avoid Tcl or python and certainly PHP for this task.
9/11/2007 12:58:21 AM
python ftw
9/11/2007 1:37:51 AM
yes, clearly, working with what windows comes with while maintaining the same code efficiency is a retarded idea
9/11/2007 2:00:26 AM
fyi guys, for text parsing, perl and php are like 90% interchangeable. Also, not that he would even care to do this, but if you run the code through zend, it's also a good bit faster than perl.
9/11/2007 2:38:24 AM
python
9/11/2007 7:19:17 AM
without even reading this threadjust reading the title "suggest a language for parsing a text file"the only answer is perl
9/11/2007 10:19:21 AM
QBasic or Pascal.
9/11/2007 11:49:18 AM
PARSING TEXT > REGULAR EXPRESSIONSThe language you use doesn't even matter. Regular expressions are powerful and versatile and designed SPECIFICALLY TO FACILITATE PARSING TEXT!
9/11/2007 5:23:41 PM
Assembly
9/11/2007 5:54:14 PM
^ oh, word. that shit rocks. you can use the RISC emulator from ECE 206.
9/11/2007 6:13:29 PM
^^^yes it does, because not all languages support regex. luckily php and perl do, and use almost the same standards
9/11/2007 6:38:12 PM
I tried doing some regex stuff once, and it made my head explode.
9/11/2007 6:40:45 PM
9/11/2007 7:23:44 PM
^ traitor
9/11/2007 7:24:54 PM
9/11/2007 7:47:47 PM
COBOL always wins my vote[Edited on September 11, 2007 at 8:19 PM. Reason : PARSE STRINGPART FROM STRINGTOTAL]
9/11/2007 8:17:50 PM
c supports regular expressions natively?[Edited on September 11, 2007 at 8:51 PM. Reason : like the posix regex stuff or what]
9/11/2007 8:49:26 PM
To say that C supports regexp is really a stretch. To say that some implementations of the C stdlib have limited support for some form of regular expressions would be much more accurate. I think a lot of people struggle with the difference between a programming language and a platform. That being said...it's interesting to see the difference b/w people who have grown up with mostly VM-based language platforms.
9/11/2007 10:18:32 PM
perl >>>> *
9/11/2007 10:22:45 PM
brainfuck. http://www.dmoz.org/Computers/Programming/Languages/Brainfuck/
9/11/2007 10:45:23 PM
Speaking of Perl i was looking something up, and found this research into number theorydo any of you remember Carl Sagan's Contact? You wont believe the pattern that's been found -----------begin Perl code here---------------
$maxerrors = 220; # needs tuning$pi = reverse "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378201667323156423156323187423187323128423128323658323697323647223923101167323156423156323287323187423128323128323158423158323197423197323147723923101167323656323187123187223187423528323158423158323197423197323147723923101167323156423156323187223187123187323128423128323158423158323197423197323147723923101167423456423187323287323628323158423158323697323147723923301723923101667323128423128323696823108823101167423128323128823196823108823101167423528623396423508823101167323128423128823196323108423108823101167323628323696323608823401696323127423127623148223101196323127423127623148223101923396323627623148223101196323127423127623148223101696323127423127423548101";while ($offset < length($pi)) { my($x) = substr($pi, $offset +++ 0, 2); my($y) = substr($pi, $offset +++ 1, 1); # XXX should be 3? my($z) = substr($pi, $offset +++ 2, 1); if ($x * cos($y) / cos($z)) { $dbg .= chr ($x) x $y; if (++$errors >= $maxerrors) { # "cannot happen" die("$dbg\n"); } }}# passes sig testprint("ok!\n");
9/12/2007 2:45:56 AM
TTTTT H H EEEEEE T H H E T HHHHHH EEE T H H E T H H EEEEEE PPPPPP EEEEEE RRRRRR L P P E R R L PPPPP EEE RRRRR L P E R R L P EEEEEE R R LLLLLL J OOOOOO U U RRRRRR NN N AAAA L J O O U U R R N N N A A L J O O U U RRRRR N N N AAAAAA L J O O U U R R N NN A A L JJJJJJ OOOOOO UUUUUU R R N N A A LLLLLL
9/12/2007 7:00:27 AM