K_Edw has asked for the wisdom of the Perl Monks concerning the following question:
A B C D E A 1 1 1 1 1 B 1 1 1 1 1 C 1 1 1 1 1 D 1 1 1 1 1 E 1 1 1 1 1
I wish to be able to access and modify this entry. Ordinarily to access a specific element I would use something like:
perl -lanse 'print $F[$j-1] if $. == $i' -- -i=1 -j=1However this prints 'A' and does not recognise the initial tab as counting as an element. Is there a way to print something into this first element? For example producing:
ID A B C D E A 1 1 1 1 1 B 1 1 1 1 1 C 1 1 1 1 1 D 1 1 1 1 1 E 1 1 1 1 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Access and modify specific element of tab delimited .txt file
by Eily (Monsignor) on Mar 30, 2016 at 11:21 UTC | |
|
Re: Access and modify specific element of tab delimited .txt file
by BrowserUk (Patriarch) on Mar 30, 2016 at 11:16 UTC | |
by K_Edw (Beadle) on Mar 30, 2016 at 12:24 UTC | |
by BrowserUk (Patriarch) on Mar 30, 2016 at 12:32 UTC | |
|
Re: Access and modify specific element of tab delimited .txt file
by duelafn (Parson) on Mar 30, 2016 at 14:05 UTC | |
by mr_mischief (Monsignor) on Mar 31, 2016 at 15:19 UTC |