How to cut a single file into multiple files and save them with different names in UNIX? -
i have file contains create table of several tables. want cut file multiple parts , save them name present in script.
for example have,
create table abc_bcd.xyz , ..... create table abc_bcd.pqr , ......
now want file divided every table , saved name xyz , pqr.
i tried
awk '/create/{x="table"++i ".ddl";}{print > x;}' filename
but gave me files named table1.ddl , table2.ddl etc.
thanks in advance.
@shellter yes, complete create table script more 1 line. file like:
create table abc_bcd.xyz , ( column1 datatype, column2 datatype, ......); create table abc_bcd.pqr , ( column1 datatype, column2 datatype, ......); ... ... ...
my requirement cut file table wise , save them name xyz, pqr , on.
i tried combine awk , grep not achieve requirement.
Comments
Post a Comment