On Sat, Jun 24, 2006 at 02:04:45PM +0800, jhuniepi wrote:
> how to do this in bash.
$ cat file
model01,,,serial12
model02,,,serial35
model04,,,serial98
model90,,,serial71
$ IFS=','; while read -a array; do echo ${array[0]} ${array[3]}; done < file
model01 serial12
model02 serial35
model04 serial98
model90 serial71
> please dont use perl.
Why not? :-P
$ perl -F/,/ -anle 'print "@F[0,3]"' file
model01 serial12
model02 serial35
model04 serial98
model90 serial71
--
$_=q:; # SHERWIN #
70;72;69;6e;74;20;
27;4a;75;73;74;20;
61;6e;6f;74;68;65;
72;20;50;65;72;6c;
20;6e;6f;76;69;63;
65;27;:;;s=~?(..);
?=pack q$C$,hex$1;
;;;=egg;;;;eval;;;
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph