Menu
Forum
General Car Audio
Subwoofers
Speakers
Amplifiers
Head Units
Car Audio Build Logs
Wiring, Electrical and Installation
Enclosure Design & Construction
Car Audio Classifieds
Home Audio
Off-topic Discussion
The Lounge
What's new
Search forums
Gallery
New media
New comments
Search media
Members
Registered members
Current visitors
Classifieds Member Feedback
SHOP
Shop Head Units
Shop Amplifiers
Shop Speakers
Shop Subwoofers
Shop eBay Car Audio
Log in / Register
Forum
Search
Search titles and first posts only
Search titles only
Search titles and first posts only
Search titles only
Log in / Join
What’s new
Search
Search titles and first posts only
Search titles only
Search titles and first posts only
Search titles only
General Car Audio
Subwoofers
Speakers
Amplifiers
Head Units
Car Audio Build Logs
Wiring, Electrical and Installation
Enclosure Design & Construction
Car Audio Classifieds
Home Audio
Off-topic Discussion
The Lounge
What's new
Search forums
Menu
Reply to thread
Forum
Off-topic Discussion
The Lounge
Programming in Perl - Need Some Help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="qtipextra" data-source="post: 4855434" data-attributes="member: 555270"><p>Im dusting off my brain, trying to write a in Perl.</p><p></p><p>What I am doing is taking a log file and trying to return just the filename.</p><p></p><p>A line of the log file looks like this:</p><p></p><p>[CODE]Error: SetupDecompressOrCopyFile() "C:\Documents and Settings\QTIP\Desktop\new\I386\BEEP.SYS" to "C:\UBCD4Win\BartPE\I386\SYSTEM32\DRIVERS\BEEP.SYS" 2: The system cannot find the file specified.[/CODE]</p><p>This is the code that I have so far. I am trying to use the split function to return the only the filename (the one listed first)</p><p></p><p>[CODE]system ("cls") ;</p><p>open( FILE, 'log.log' ) or die( "Cannot open: $!" );</p><p>@log = &lt;FILE&gt; ;</p><p>close (FILE) or die ( "Cannot open: $!" );</p><p>foreach (@log) { @split = split (/Error:/, $_, 9999) ; }</p><p></p><p>print @split ;[/CODE]</p><p>And right now all this outputs is the last line of the log file, which is this:</p><p></p><p>[CODE]Use the [&lt;&lt;] and [&gt;&gt;] buttons to jump to Error/Warning.[/CODE]</p><p>Anyone good with perl help me out?</p></blockquote><p></p>
[QUOTE="qtipextra, post: 4855434, member: 555270"] Im dusting off my brain, trying to write a in Perl. What I am doing is taking a log file and trying to return just the filename. A line of the log file looks like this: [CODE]Error: SetupDecompressOrCopyFile() "C:\Documents and Settings\QTIP\Desktop\new\I386\BEEP.SYS" to "C:\UBCD4Win\BartPE\I386\SYSTEM32\DRIVERS\BEEP.SYS" 2: The system cannot find the file specified.[/CODE] This is the code that I have so far. I am trying to use the split function to return the only the filename (the one listed first) [CODE]system ("cls") ; open( FILE, 'log.log' ) or die( "Cannot open: $!" ); @log = <FILE> ; close (FILE) or die ( "Cannot open: $!" ); foreach (@log) { @split = split (/Error:/, $_, 9999) ; } print @split ;[/CODE] And right now all this outputs is the last line of the log file, which is this: [CODE]Use the [<<] and [>>] buttons to jump to Error/Warning.[/CODE] Anyone good with perl help me out? [/QUOTE]
Insert quotes…
Verification
Post reply
Forum
Off-topic Discussion
The Lounge
Programming in Perl - Need Some Help
Top
Menu
What's new
Forum list