How to exclude first and last lines while reading data into a sequential file(having some 1000 records).I guess probably by using unix filter option but not sure which to use

Answers were Sorted based on User's Feedback



How to exclude first and last lines while reading data into a sequential file(having some 1000 recor..

Answer / sam

In sequential file stage, properties tab --- options -- filter

At filter type unix command -- sed '1d;$d'

Is This Answer Correct ?    8 Yes 0 No

How to exclude first and last lines while reading data into a sequential file(having some 1000 recor..

Answer / vinod upputuri

In order to exclude the contents while reading from the
sequential file stage we have to use the filter option.

There we have to specify the unix command:

Sed -e '1d' -e '$d' <filename>

Is This Answer Correct ?    8 Yes 1 No

How to exclude first and last lines while reading data into a sequential file(having some 1000 recor..

Answer / msbharathi

In sequential file stage use the filter in the options

In filter use sed '1d;$d'

You can use sed '<start>,<end>d' to delete particular rows and use sed -n '<start>,<end>p' to keep particular rows

Is This Answer Correct ?    1 Yes 0 No

How to exclude first and last lines while reading data into a sequential file(having some 1000 recor..

Answer / sreenu

By using Unix Command Head , Tail

Is This Answer Correct ?    1 Yes 1 No

How to exclude first and last lines while reading data into a sequential file(having some 1000 recor..

Answer / shiv

Sreenu is also right, but we have another option as well.
Use head and tail stages in datastage like this:

Seq_File-->Tail_stage--->Head_Stage---->Dataset(Target)

in this way first u can exclude the first record using tail specify 999 record in tail stage, then u can exlclude last record by using head stage.(998 top records).

Is This Answer Correct ?    1 Yes 2 No

How to exclude first and last lines while reading data into a sequential file(having some 1000 recor..

Answer / shar

Well if must use filter option in sequential stage then
the Ans is:

head -n 10 'FileName' | tail -n 8

explanation:
suppose if ur file has 10 records + column name then total
lines are 11.
col1
1
2
3
4
5
6
7
8
9
10

head -n 10 will fetch column name + 9 records
and
tail -n 8 will fetch 2 to 9 records excluding colname and
1st record.
like :
2
3
4
5
6
7
8
9
Thats it.

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Data Stage Interview Questions

What is Cleanup Resources and when do you use it?

2 Answers  


insequential file 2header avaliable,and 100 records avaliable.how to skip the 2 headers and load 100 records target?

5 Answers  


how many stages are there in Datastage... Please clarify mee??

3 Answers  


What is the surrogate key? what is the use of surrogate key? how to Create surrogate key Generator in scd2 in 8.5?

5 Answers   SLK Software,


In my source i have 10 records but i want 11 records in target. How can i acheive this in Server jobs.

2 Answers   IBM,






Suppose take my name "Reddyvaraprasad" From source it is coming Reddy vara prasad Need to get As Reddyvara prasad/

4 Answers   TCS,


wt is the diff b/w odbc and oracle stage

2 Answers   Accenture, HCL,


Differentiate between hash file and sequential file?

0 Answers  


how to unlock a locked job in datastage 8.0

3 Answers   HCL,


I am defining one varaible parameter date in job parameters.I want use this variable date in where clause in source query.

2 Answers   TCS,


if we using two sources having same meta data and how to check the data in two sources is same or not? and if the data is not same i want to abort the job ?how we can do this?

1 Answers   IBM,


In Datastage, how you can fix the truncated data error?

0 Answers  


Categories