OT -- Scripting names from a file

HaJo Schatz hajo at hajo.net
Tue Sep 28 14:43:49 UTC 2004


On Tue, 2004-09-28 at 22:36, Chadley Wilson wrote:

> Lets say for example I have a text file with one name on each line and I need 
> to create files based on the names in that file, If I can use a for loop it 
> would be greate, but I don't know how to get each name from the file,

Usually do things in Perl, but that's a personal taste I guess:

#!/usr/bin/perl
@files = `cat files.txt`;
foreach $file (@files)
{
    chomp $file; # No new-line
    print "$file\n";
}

Or say `touch $file`; instead of print "...";

> 
> Thanks Guys
> -- 
> Chadley Wilson
> Redhat Certified Technician 
> Cert Number: 603004708291270
> Pinnacle Micro
> Manufacturers of Proline Computers
> ====================================
> Exercise freedom, Use LINUX
> =====================================
-- 
HaJo Schatz <hajo at hajo.net>
http://www.HaJo.Net

PGP-Key:  http://www.hajo.net/hajonet/keys/pgpkey_hajo.txt




More information about the fedora-list mailing list