Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


This is UNIX question asked in DataStage Interview.
Say I have n numbers of records in a text file.
I want first 3 records in 1st file, last three records in 3rd file and remaining n-6 records in 2nd file.
(Note: we don't know how many records are there in the File. I am getting one file on daily basis and I want three target files as asked above)

Answers were Sorted based on User's Feedback



This is UNIX question asked in DataStage Interview. Say I have n numbers of records in a text file...

Answer / reddy

First check the filename how many records are there
wc -l finename
it will give count

then first check the filename if it has header and footer

If not use below unix commands

when we use wc -l filename, it will give count, for example we have 1000 records

Ans1: Head -3 filename.txt >Target1.txt
Ans2: Tail -3 filename.txt >Target3.txt
Ans3: sed -n '4,997p' filename >Target2.txt

Please correct me if i am wrong....

Is This Answer Correct ?    13 Yes 1 No

This is UNIX question asked in DataStage Interview. Say I have n numbers of records in a text file...

Answer / ram

head -3 filename.txt > t1.txt
tail -3 filename.txt > t2.txt
cat filename.txt|sed '3d,$d'|sed '$d'|sed '$d' > t3.txt

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Stage Interview Questions

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?

0 Answers   Wipro,


What is mapping?

3 Answers  


how to find diff between 2 dates without using Icon... funtions?

1 Answers  


1)i put Pharma Project in my Resume..whar are the sources used in my project Generally? 2)how many fact and dimensional tables used? 3)Have u used any Datamarts and measues in fact table? ....plz give the answers...

2 Answers   iGate,


how to find no.of records in sequntial file itself?

4 Answers  


What is the sortmerge collector?

0 Answers  


1)How will u implement SCD2 by using surrogate key. 2)What are the disadvantages with surrogate key. 3)How will you handle nulls in your project for the varchar, integer data types. 4)Can I use two fact tables in star schema. 5)3 jobs are running on the 2 nodes after I added one more node so can I compile those jobs to run on three nodes.

0 Answers  


What is difference between join, merge and lookup stage?

0 Answers  


How to read multiple files using a single datastage job if files have the same metadata?

0 Answers  


how to read 100 records at a time in source a) hw is it fr metadata Same and b) if metadata is nt same?

0 Answers   HCL,


Explain the scenarios where sequential file stage runs in parallel?

3 Answers   Accenture,


Explain briefly scd type2 in datastage7.5x2(parallel)

1 Answers   IBM,


Categories