<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 18-Apr-08, at 6:45 AM, Alex Mackinnon wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div class="hmmessage" style="font-size: 10pt; font-family: Tahoma; ">Sinner!&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;<br>I agree use awk but in Perl use split and take a slice of the array.<br>($firstcolumn, $tenth) = (split (/\t/, $string_with_tab))[0,9];</div></span></blockquote><div><br></div>If you want to do this then beware of split's behaviour of eliminating empty fields on the right, if undef vs '' matter to you:</div><div><br></div><div><div>&nbsp;&nbsp;DB&lt;1> $s = "1\t2\t\t4\t\t\t7\t\t\t\t\t\t"</div><div><br></div><div>&nbsp;&nbsp;DB&lt;2> x (split /\t/, $s)[0, 9]</div><div>0 &nbsp;1</div><div>1 &nbsp;undef</div><div>&nbsp;&nbsp;DB&lt;3> x (split /\t/, $s, -1)[0, 9]</div><div>0 &nbsp;1</div><div>1 &nbsp;''</div><div>&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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div></div><div><br></div><div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div class="hmmessage" style="font-size: 10pt; font-family: Tahoma; "><br>&nbsp;<br><br><br><br>&nbsp;<br><hr id="stopSpelling"><br>> Date: Thu, 17 Apr 2008 16:43:05 -0400<br>> From:<span class="Apple-converted-space">&nbsp;</span><a href="mailto:sfryer@sourcery.ca">sfryer@sourcery.ca</a><br>> To:<span class="Apple-converted-space">&nbsp;</span><a href="mailto:tpm@to.pm.org">tpm@to.pm.org</a><br>> Subject: Re: [tpm] eliminating columns from tab delimited files<br>><span class="Apple-converted-space">&nbsp;</span><br>> On Thu, Apr 17, 2008 at 04:05:44PM -0400, Omid Gulban wrote:<br>> > does anyone have a quick way of eliminating certain columns from a tab-delimited file.<br>><span class="Apple-converted-space">&nbsp;</span><br>> I know it's not very Perl'ish, but have you considered using `awk`?<br>> We all love Perl, but sometimes it's overkill. Beyond that, unless<br>> you're experiencing performance issues, I don't see any reason not<br>> to do it the way you described.<br>><span class="Apple-converted-space">&nbsp;</span><br>> Cheers,<br>> --<br>> Shaun Fryer<br>> cl: 905-920-9209<br>> _______________________________________________<br>> toronto-pm mailing list<br>><span class="Apple-converted-space">&nbsp;</span><a href="mailto:toronto-pm@pm.org">toronto-pm@pm.org</a><br>><span class="Apple-converted-space">&nbsp;</span><a href="http://mail.pm.org/mailman/listinfo/toronto-pm">http://mail.pm.org/mailman/listinfo/toronto-pm</a><br><br><br><hr>Sign in to Windows Live Messenger, and enter for your chance to win $1000 a day—today until May 12th.<span class="Apple-converted-space">&nbsp;</span><a href="http://g.msn.ca/ca55/210" target="_new">Visit SignInAndWIN.ca</a><span class="Apple-converted-space">&nbsp;</span>_______________________________________________<br>toronto-pm mailing list<br><a href="mailto:toronto-pm@pm.org">toronto-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/toronto-pm">http://mail.pm.org/mailman/listinfo/toronto-pm</a><br></div></span></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="khtml-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Mike Stok &lt;<a href="mailto:mike@stok.ca">mike@stok.ca</a>></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://www.stok.ca/~mike/">http://www.stok.ca/~mike/</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="khtml-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The "`Stok' disclaimers" apply.</div><div><br class="khtml-block-placeholder"></div><div><br class="khtml-block-placeholder"></div></div><br class="Apple-interchange-newline"></span> </div><br></body></html>