Append 4 files in UNIX

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
e1994264
Premium Member
Premium Member
Posts: 28
Joined: Mon Jul 18, 2011 5:12 pm

Append 4 files in UNIX

Post by e1994264 »

Hi,
I am getting 4 files and i need to append them into a single file in UNIX
Please can anybody give sample UNIX script code
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

cat A B C D > E

Do the files have header records?
-craig

"You can never have too many knives" -- Logan Nine Fingers
e1994264
Premium Member
Premium Member
Posts: 28
Joined: Mon Jul 18, 2011 5:12 pm

Post by e1994264 »

chulett wrote:cat A B C D > E

Do the files have header records?
Yes
Example :
How can we a shell script and pass date parameters .I have 3 files comming from Datastage with |" delimited

I need append 3 files as above: File1:

P0000|"47416954|"AU|"000|"INS|"0000|"|"20060601|"99991231|"|"|"|"|"01




File 2:

P0001|"47416954|"AU|"000|"INS|"0001|"|"20060501|"99991231|"|"|"|"|"4210|"4210|"1|"2S|"GB|"|"4211|"8M




File 3:

P0002|"47416954|"AU|"000|"INS|"0002|"|"20060601|"99991231|"|"|"|"|"ALLY-POLLARD|"|"LEILA|"|"LEILA|"00|"2|"2|"19760411|"GB|"|"1|"20040828|"|"|"|"JE397813B




After append 3 files i need add Header and trailer for the single file

Header Should have following inforamtion:

RECTYP|"CLientid|"Cleint Name|"email|"RunDate|"RunTime

Rundate:YYYYMMDD format need to be passed

Run Time: HHMMSS in 24 hour format should be passed



Trailer Record:

RECTYP|"RECORD COUNT



Sample output should be like this

HEADR|"GVAADP|"ID |"MANI|"|"OT20060403|"20060403|"050020


P0000|"47416954|"AU|"000|"INS|"0000|"|"20060601|"99991231|"|"|"|"|"01

P0001|"47416954|"AU|"000|"INS|"0001|"|"20060501|"99991231|"|"|"|"|"4210|"4210|"1|"2S|"GB|"|"4211|"8M

P0002|"47416954|"AU|"000|"INS|"0002|"|"20060601|"99991231|"|"|"|"|"POLLARD|"|"LEILA|"|"LEILA|"00|"2|"2|"19760411|"GB|"|"1|"20040828|"|"|"|"JE397813B

TRAIL|"3
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... exactly the same scenario that you've outlined here but now you want to know how to script it rather than use a job? If so, there are other web forums where it would be more appropriate to post questions like that, I'm afraid.
-craig

"You can never have too many knives" -- Logan Nine Fingers
e1994264
Premium Member
Premium Member
Posts: 28
Joined: Mon Jul 18, 2011 5:12 pm

Post by e1994264 »

If you how to script above senario. Please let me know. \
Thanks for your concern
Post Reply