<div>Actually, I believe all the suggestion would work until I realized that every now in then there is a column that is completely blank and then it throw everything off. Here is an example of the output:<br><br>-rw---- 2&nbsp; 14&nbsp; &lt;UNSPECIFIED&gt; 14:53 fax00003459.tif<br>-rw---- 1&nbsp; 14&nbsp; 501 443 9393&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 14:58 fax00003460.tif<br>-rw---- 1&nbsp; 14&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15:01 fax00002470.tif<br><br>That occasional empty column messes it up.&nbsp; Is there a way to accommodate for that?<br><br>Sorry, for the added wrinkle.&nbsp; I had not noticed that before.<br><br>Richard<br><b><br><blockquote class="xoEncapsulatedBody" style="margin-left: 5px; padding-left: 0px;">Chicago.pm chatter &lt;chicago-talk@pm.org&gt; wrote:</blockquote>
</b><blockquote class="xoEncapsulatedBody" style="border-left: 2px solid blue; margin-left: 5px; padding-left: 10px;"><div>I have no idea what your faxstat -r output looks like, but why no collapse all of the white space down to single spaces, then you can split on the singles space:</div>
<div>&nbsp;</div>
<div>$line =~ s/\s+/ /g;</div>
<div>&nbsp;</div>
<div>then you can split on the single space.</div>
<div>&nbsp;</div>
<div>&nbsp; DB&lt;3&gt; $line = 'a b&nbsp; c&nbsp;&nbsp; d&nbsp;&nbsp;&nbsp;&nbsp; e&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f';</div>
<div>&nbsp; DB&lt;4&gt; $a=$line</div>
<div>&nbsp; DB&lt;5&gt; $a =~ s/\s+/ /g;</div>
<div>&nbsp; DB&lt;6&gt; p $a<br>&nbsp;a&nbsp; b&nbsp; c&nbsp; d&nbsp; e&nbsp; f</div>
<div>&nbsp; DB&lt;7&gt; @a=split(" ", $a);</div>
<div><br>&nbsp; DB&lt;8&gt; x @a<br>0&nbsp; 'a'<br>1&nbsp; 'b'<br>2&nbsp; 'c'<br>3&nbsp; 'd'<br>4&nbsp; 'e'<br>5&nbsp; 'f'</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>ydy<br><br></div>
<div class="gmail_quote">On Tue, Mar 2, 2010 at 8:46 AM, Richard Reina <span dir="ltr">&lt;<a href="mailto:richard@rushlogistics.com">richard@rushlogistics.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">I'm sorry for asking what likely should be a simple question but after spending a fair amount of time playing with qw(), split(), join(), etc. I still have not figured it out.<br>
<br>I have some fairly messy system output which I have managed to isolate into a scalar with<br><br>use strict;<br>my @received = `faxstat -r`;<br><br>I can't figure out how to neatly get this into an array so I can get the output into a database table;<br>
<br>I've gotten this far;<br><br>my $line;<br>my @fax;<br><br>foreach $line (@received) {<br><br>&nbsp; &nbsp;if (substr($line,0,5) eq "-rw---") { # make sure it's an actual fax<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # and not the title of the output<br>
&nbsp; &nbsp; &nbsp; &nbsp;chomp($line);<br>&nbsp; &nbsp;}<br>}<br><br>$line is exactly what I want but it's in the form of a scalar; &nbsp;When I try to split it up into elements of an array with @fax=split("", $line); it does not work due to all the back to back white spaces. &nbsp;If anyone can help me out with a better way to do this I would really appreciate it.<br>
<br>Thanks,<br><br>Richard<br>_______________________________________________<br>Chicago-talk mailing list<br><a href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/chicago-talk" target="_blank">http://mail.pm.org/mailman/listinfo/chicago-talk</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>I take the "Shhhh" out of IT - ydy<br>
</blockquote></div>