I am unable to fetch the proper output for the above command.
Detailed information.
My source file:
"0","ANC BC","01","1200",1,"2000-01-11-13:13:13"
1,Customer Information sales Header 1,"Columns_name1","Columns_name2","Columns_name3","Columns_name4"
1,Customer Information sales Header 2,"CustomerID","ICode","InformationDate","Information"
"1","Customer Information Sales Detail","1000","abc","2000-01-31","ccc"
"1","Customer Information Sales Detail","1234","bbb","2000-01-31","aaa"
1,Product Information Header 1,"Columns_name1","Columns_name2","Columns_name3","Columns_name4"
1,Product Information Header 2,"ProductID","ICode","InformationDate","Information"
"1","Product Information Detail","1000","abc","2000-01-31","ccc"
"1","Product Information Detail","1234","bbb","2000-01-31","aaa"
"9",2,3,4
script
a=$codenumber #code number is 1200 -1500
b=$pid #pid is period date 20011212
awk -v var1=$a,var2=$b 'BEGIN{FS=OFS="\""}{gsub(/ /,"_",$0) ;print > $4"_"var1"_"var2".txt"}' myfile_name.txt
Finally i need to the output of only start with Detail file, i dont require all the header and trailer files.
Customer_Information_Sales_Detail_1200_20011212.txt
"1","Customer Information Sales Detail","1000","abc","2000-01-31","ccc"
"1","Customer Information Sales Detail","1234","bbb","2000-01-31","aaa"
Product_Information_Detail_1200_20011212.txt
"1","Product Information Detail","1000","abc","2000-01-31","ccc"
"1","Product Information Detail","1234","bbb","2000-01-31","aaa"
Thanks