Totally new to shell scripting

lllll

Is this a homework assignment?

I have been trying to figure this part out for like 2 weeks now and I keep hitting a brick wall and so finally decided to see if I could find some help

---------- Post updated at 12:41 PM ---------- Previous update was at 12:41 PM ----------

No this is not a homework assignment

Please show us a representative sample input file and the corresponding output files that should be produced from that input (all shown in CODE tags).

.....

I don't understand what you're trying to do.
I thought you ware saying that you wanted to create NUM_FILES separate XML files with each output file containing the header and trailer and ~1/3 of the <BASIC>...</BASIC> tags.
But, since your input file only has one set of BASIC tags, there must be some other goal that I'm not understanding from your description.

hytrhg

So, it this what you want?

A full record will have signature,basic and trailer.

If there are 12 set of records in the input xml file, you need to separate them into 3 xml files each with 4 (=12/3) sets?
If there are 13 set of records in the input xml file, you need to separate them into 3 xml files, first xml with 5, second and third each with 4? or first and second with 4 and third with 5?

--ahamed

43532

So, how do you want to stack the records?

first rec to first file
second rec to second file
third rec to third file
fourth rec to first file
fifth rec to second file
and so on

or

first x records to first file
next y records to second file
final z records to third file

or

you just want records split across files but not in any specific order?

?

--ahamed

---------- Post updated at 11:43 AM ---------- Previous update was at 11:40 AM ----------

BTW where is your sample input xml?

Again, you said you wanted the signature and trailer as well along with basic right? So, this signature and trailer occur for every basic record or is it one per file?

--ahamed

first x records to first file
next y records to second file
final z records to third file

sdfrd

Can you please paste the sample xml?

--ahamed

vfetg

I am assuming <Basic-Record-Count>xxx</Basic-Record-Count> will have the total no of basic records in the input xml file right?

--ahamed

Yes that is right

What OS are you using (output from uname -a ) and which version of the Korn shell are you using (output from /usr/bin/ksh --version )?

qwerd

What is the output from the command:

/usr/bin/ksh --version

xcvbn