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)

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe the main features of datastage?

1072


What is the purpose of pivot stage and types of containers in datastage

1033


Why do we use exception activity in Datastage?

1301


what is repositery?

1839


What is developer responsibilities in UAT (user acceptance testing and Post implementation phase?

2100


How do you generate sequence number in datastage?

1084


A signal has a wavelength of 1 micro min in air.how far can the front of the wave travel during 1000periods?

2499


What are the different type of jobs in datastage?

1039


How a server job can be converted to a parallel job?

1090


Nls stands for what in datastage?

1187


What is use Array size in datastage

1774


What are the repository tables in datastage?

1301


If we take 2 tables(like emp and dept),we use join stage and how to improve the performance?

2042


Explain entity, attribute and relationship in datastage?

1091


What are the enhancements made in datastage 7.5 compare with 7.0?

1146