Another approach - you can pass multiple arguments and control the filenames:
Code:
awk 'FNR == 1 { c = 1 }
{ close(FILENAME c-1)
print > (FILENAME (!(FNR%30000000) ? ++c : c))
}' file_1 file_2 ... file_n
or:
Code:
awk 'FNR == 1 { c = 1 }
{ print > (FILENAME c) }
!FNR%30000000 { close(FILENAME c); ++c }
' file_1 file_2 ... file_n
Use nawk or /usr/xpg4/bin/awk on Solaris.
Last edited by radoulov; 12-14-2007 at 08:32 PM..
|