Generating multiple files based on contents from 1 file.
Generating multiple files based on contents from 1 file.
(OP)
Hello, I am new to AWK and I was wondering if I can use AWK for this:
I have to generate multiple files for a performance testing task where only the filename and a string within the file would be incremented for each test file. We need to generate thousands of files which is why we are looking for an automated solution. Can I create a "master" file for this and have AWK use this file to generate all my test files? Here's what I'm thinking:
Master File contains:
1. filename = WAWF_I_002-TEST-XXXX.xml (where XXXX will be incremented for each file)
2. include a variable within the data to increment my invoice number to correspond to the filename (<Invoice_Document.Invoice_Identification.Identifier>6U02130228-XXXX</Invoice_Document.Invoice_Identification.Identifier>)
3. all remaining data to be included on each file as noted except for the invoice number (possibly surrounded by {} or any other special character to indicate the beginning and ending of the data block)
Any thoughts on this? Will this be a good approach to take? Your help with this will be greatly appreciated.
Thanks,
Gilmar
I have to generate multiple files for a performance testing task where only the filename and a string within the file would be incremented for each test file. We need to generate thousands of files which is why we are looking for an automated solution. Can I create a "master" file for this and have AWK use this file to generate all my test files? Here's what I'm thinking:
Master File contains:
1. filename = WAWF_I_002-TEST-XXXX.xml (where XXXX will be incremented for each file)
2. include a variable within the data to increment my invoice number to correspond to the filename (<Invoice_Document.Invoice_Identification.Identifier>6U02130228-XXXX</Invoice_Document.Invoice_Identification.Identifier>)
3. all remaining data to be included on each file as noted except for the invoice number (possibly surrounded by {} or any other special character to indicate the beginning and ending of the data block)
Any thoughts on this? Will this be a good approach to take? Your help with this will be greatly appreciated.
Thanks,
Gilmar
RE: Generating multiple files based on contents from 1 file.
Try something like this:
CODE
----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
RE: Generating multiple files based on contents from 1 file.
-bash: [: i: integer expression expected
Do I need to add something to my logic piece? Also, I noticed this is using SED. Does SED work as well as AWK?
Thanks,
Gilmar
RE: Generating multiple files based on contents from 1 file.
while [ i -le max ]
with this:
while [ $i -le $max ]
Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?
RE: Generating multiple files based on contents from 1 file.
Thanks again,
Gilmar