to remove first line from mutiple files

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

developeretl
Participant
Posts: 89
Joined: Sat Jul 24, 2010 11:33 pm

to remove first line from mutiple files

Post by developeretl »

Hi ,
I have three files which contain first line as UTF8. I have used sed command to remove the first line. It worked but I'm testing the job so each time when I run the job it deletes the first line. Is there any other way so that I can exclude the first line and run the job using the logic in the stages ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Parallel job as marked or Server job as per the forum posted in?

If you are only processing one file at a time then simply tell the Sequential File stage that you have 1 header record, it will automatically be skipped.
-craig

"You can never have too many knives" -- Logan Nine Fingers
developeretl
Participant
Posts: 89
Joined: Sat Jul 24, 2010 11:33 pm

Post by developeretl »

I'm processing 3 files at a time. I have to skip the first line of the files and process the files. This is related to parallel jobs.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So here we are in the right place now. Are you using the "File Pattern" option to read the multiple files? From what I recall, it will only skip the header record from the first file rather than all of them which I find rather... stupid.

If your sed command is working, have you tried leveraging that in the Filter option of the stage?
-craig

"You can never have too many knives" -- Logan Nine Fingers
developeretl
Participant
Posts: 89
Joined: Sat Jul 24, 2010 11:33 pm

Post by developeretl »

Im reading the 3 files using three sequential stages. Can you please tell me how to set it in the filter ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Three files in three stages = one at a time. Use the option to skip header records in each of the stages.
-craig

"You can never have too many knives" -- Logan Nine Fingers
developeretl
Participant
Posts: 89
Joined: Sat Jul 24, 2010 11:33 pm

Post by developeretl »

Can you please tell me how to do that in the sequential stage . Im new to datastage.
Last edited by developeretl on Thu Aug 04, 2011 10:02 am, edited 1 time in total.
developeretl
Participant
Posts: 89
Joined: Sat Jul 24, 2010 11:33 pm

Post by developeretl »

Can you please tell me how to do that in the sequential stage . Im new to datastage.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's a property in the stage and documented as well. I'm not anywhere with access so I can't quote chapter and verse where to find it but I can't imagine it would be all that hard to look up.

Worst case maybe someone else can provide the gory details.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rbpty
Premium Member
Premium Member
Posts: 6
Joined: Sat Jun 21, 2008 7:58 am

Post by rbpty »

Using the filter option in Sequential file is simple. Here you go...

Under the options tab, choose the filter option and use the below command..

sed -e '1d' Your_full_file_path_including_name
developeretl
Participant
Posts: 89
Joined: Sat Jul 24, 2010 11:33 pm

Post by developeretl »

rbpty wrote:Using the filter option in Sequential file is simple. Here you go...

Under the options tab, choose the filter option and use the below command..

sed -e '1d' Your_full_file_path_including_name

Thank you rbpty for the command
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's not the right approach for your particular job. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
developeretl
Participant
Posts: 89
Joined: Sat Jul 24, 2010 11:33 pm

Post by developeretl »

Please guide me which one is the right approach.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I have.
-craig

"You can never have too many knives" -- Logan Nine Fingers
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

I'm using 7x, and not yet familiar with differences with 8x, but here's how I'd do it:

Code: Select all

Properties
    Options
        First line is column names = True
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
Post Reply