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

How to reverse the string using unix?

3464


What is size of a transaction and an array means in a datastage?

1264


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.

3998


What are stage variables, derivations and constants?

1192


How do u convert the columns to rows in datastage?

1163


How do you import and export data into datastage?

1201


Where do you see different stages in the designer?

1061


explain about completely flow of sequencers technicaly,without using example??explain about lookup,nullhandling?

2430


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

1119


What is the difference between datastage and datastage tx?

1032


how to connect source to db?generally what r stages u used? how to find the data is having delimiter format?

2344


What are the types of hashed files in data stage

1080


How to Remove Duplicate using SQL?

1319


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

1204


Whats difference betweeen operational data stage (ods) and data warehouse?

1087