Re: getting nth column of a string

2007-10-28 Thread oryann9
is there a way to get the "nth" column of a string in perl, similar to awk '{print $col_no}' in awk ? ### There are multiple ways, but here are two examples: In the first example, split is what you need to pay attention to. In the second example, @F is the key here.

Re: getting nth column of a string

2007-10-28 Thread Chas. Owens
On 10/28/07, Mahurshi Akilla <[EMAIL PROTECTED]> wrote: > is there a way to get the "nth" column of a string in perl, similar to > awk '{print $col_no}' in awk ? snip If I remember my awk correctly $col_no (e.g. $2) gives you the nth space delimited field in the string (counting multiple spaces as

Re: getting nth column of a string

2007-10-28 Thread John W. Krahn
Mahurshi Akilla wrote: > > is there a way to get the "nth" column of a string in perl, similar to > awk '{print $col_no}' in awk ? AWK does not have a 'col_no' variable so what is it that you are trying to do? I assume that you meant: awk '{print $2}' which would print the second field of the

getting nth column of a string

2007-10-28 Thread Mahurshi Akilla
is there a way to get the "nth" column of a string in perl, similar to awk '{print $col_no}' in awk ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/