Extracting word from Line

From: R. M. Sundaram <rsundaram_at_gisqatar.org.qa>
Date: Wed, 20 May 1998 12:17:45 +0300

Thanks to Jean, Bernt, Akihito, Jim Belonis, Alan Garde.

I have one more query: is it possible to read ONE WORD at a time from
the file.
.
=============================
SUMMARY : Reading one line from file.
======================
        more -n 1 filename
=======================
$ cat /etc/motd | while read line
> do
> echo $line
> done
=========================
Take Perl and have a solution for many platforms...
Something like:
#!/usr/local/bin/perl - or whereever you install it...
$inputfile="<your-input-filename>";
open FILE, $inputfile or die "\nCan't open $inputfile\n";
while (<FILE>) {
   print "$_ \n"; # print each line...
} # end of while-loop
close FILE;
==========================
Received on Wed May 20 1998 - 11:25:11 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT