Re: OT -- Scripting names from a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
http://www.HaJo.Net

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


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux