Redirecting output in AWK

Dominic Dunlop domo at riddle.UUCP
Thu Oct 13 21:45:46 AEST 1988


In article <816 at mergvax> rkxyv at mergvax (Rob Kedoin) writes:
>I am trying to use AWK to split one file into many formatted, smaller files.
>The problem I am having is that I cannot output to more than 10 files...

The way around this problem is to have awk produce output which looks like

	cat << E_O_F > file1
	Data for file1
	...
	E_O_F
	cat << E_O_F > file2
	Data for file2
	E_O_F
	...
	cat << E_O_F > file763
	Data for file 763
	...
	E_O_F

and pipe it into the standard input of a shell.  You can even have awk do
the piping by appending  | "sh"  to the relevant print and printf lines in
the awk script.
-- 
Dominic Dunlop
domo at sphinx.co.uk  domo at riddle.uucp



More information about the Comp.unix.wizards mailing list