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 / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

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

2506


Which warehouse using in your datawarehouse

2186


which r the connectors used in san?

2188


how to implement scd2 in datastage 7.5 with lookup stage

5606


Can you filter data in hashed file?

3773


What are stage variables and constants?

1148


Why we use surrogate key?

1236


hi.... am facing typical problem in every interview " I need some critical scenarios faced in real time" plz help me guys

2865


How many types of hash files are there?

1185


What are the types of jobs we have in datastage?

1075


Which is the best institute in Hyderabad to learn OBIEE and DataStage?Please tell me faculty name also

3167


Is possible to create skid in dim,fact tables?

2637


Describe the architecture of datastage?

1010


How a source file is populated?

1067


how to write server Routine coding?

2130