From: "R. M. Sundaram" <rsundaram () gisqatar ! org ! qa>
To: tru64-unix-managers
Subject: Extracting word from Line
Date: Wed, 20 May 1998 09:17:45 +0000 [thread overview]
Message-ID: <96078708811696.tru64-unix-managers.marc@archive.invalid> (raw)
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;
==========================
reply other threads:[~1998-05-20 9:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox