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

hi i am madan, in real time data stage who is the source provide? and how to recevied in developer? Pls send me answer 

1 Answers   HCL,


Define orabulk and bcp stages?

0 Answers  


Why we need datasets ratherthan sequential files?

5 Answers  


In my project source data comes from MAINFRAME in files.so,This time data is coming as a binary file...I know for binary data we use Complex flat file stage..I have used it also..but on 'view data' data is not coming correctly..as it in MAINFRAME.give me some ideas..

2 Answers  


why we use hash file for lookup?

5 Answers  






What is the method of removing duplicates, without the remove duplicate stage?

0 Answers  


Hi,can any one please mention list of dimension and fact tables for Sales and Distribution System for a Pharmacutical company.

0 Answers   Syntel,


Thanks to all people who are posting their comments...

1 Answers   CTS,


Differentiate between Join, Merge and Lookup stage?

0 Answers  


What is diff between Junk dimensions and conform dimension?

4 Answers   Polaris,


1)s.key generate 1 to 700 records today. tomorrow another 400 will updated how to update the records using s.key generator? 2)source is like :-- DB --> T/F stage1 --> seq1file T/f 1 is linking with T/F2 ---> seq 2 how to load the data? in source i given some conditions those r going in seq1. The another data will going to seq2 how to do this ?

0 Answers   Wipro,


i WANTED TO USE THE RANGE LOOKUP SCENARIO IN DATASTAGE 7.5.2 SRVER JOB.i HAVE A DATE FIELD IN SOURCE AND I SHOULD MATCH IT WITH A FIELD IN LOOKUP FILE.BUT,THE FIELDS SHOULD MATCH EVEN THOUGH THERE IS SOME RANGE.CAN SOMEONE TELL ME HOW CAN I DO THAT. THANKS

0 Answers  


Categories