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 do you generate sequence number in datastage?

629


What are the some differences between 7.x and 8.x version of datastage?

749


Explaine the implimentation of scd's in ds indetail, please send me step by step procedure to perform scd's 1,2,3. Please replay for this, Thanks in advance

1755


why do u need the IOS upgradation in a FC switch

1879


Can you explain how could anyone drop the index before loading the data in target in datastage?

904






Have you have ever worked in unix environment and why it is useful in datastage?

657


How many areas for files does datastage have?

647


how to export or import the jobs in .ISX file

725


what are the devoleper roles in real time? plz tell i am new to datastage....

1647


Difference between data warehousing and olap?

656


How do you import and export data into datastage?

707


What is a ds designer?

647


Describe the main features of datastage?

662


What can we do with datastage director?

679


Why fact table is in normal form?

685