TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

awk syntax help needed



        I need to know how to use the system() function in awk.
I need to take a list of filenames (with no extension), and move files with
those names (but varying extensions, which i will specify in the script),
from one directory to another. the manuals are remarkably unhelpful in this
case...

here's the line in question:
system(cp /from/this/dir/$1.ext /home/here/ )

and here's the error it gives:
awk: copy.awk:7: system(cp /from/this/dir/$1.ext /home/here/ )
awk: copy.awk:7:                                            ^ parse error
awk: copy.awk:7: fatal: system() cannot have 0 arguments                

why does it give me a parse error on that command? I've tried just the bare
command on the command line, and it works fine.

Carl Soderstrom

p.s. I know that Perl will do the job too.. but I know neither awk nor perl,
and awk seemed like a more straighforward solution to learn at the moment. :)
System Administrator	307 Brighton Ave. 
Minnesota DHIA		Buffalo, MN	
carls@agritech.com	(612) 682-1091