Read nth Row from a File using Sequential File Stage in Datastage

How to read nth Row from a File using Sequential File Stage in Datastage
Scenario is as follows:
I have only two stages in a job
SeqFileStage1------> SeqFileStage2
I have to read only 6th Row from File 1 and write it in File2.

Showing Answers 1 - 9 of 9 Answers

sree

  • Sep 9th, 2015
 

using this unix command we get a record head -6 | tail -1

  Was this answer useful?  Yes

Krishna

  • Sep 19th, 2017
 

In sequential file, Use the filter command head -6|tail -1

  Was this answer useful?  Yes

Biswajit Rath

  • Mar 11th, 2018
 

We can solve the question by using the head as well as the tail command. So let me explain the answer for finding the nth line by using both the head and tail command.
head -nthline fileName | tail -1
--------------------------------------------------
tail -n +nthline fileName | head -1
So as you want to get only the 6th line , so it can be done in two ways.
head -6 fileName | tail -1
-----------------------------------------------------
tail -n +6 fileName | head -1

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions