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

Give an idea of system variables.

587


What are the various kinds of containers available in datastage?

561


what are the errors,warnings in datastage

2145


What are datastage sequences?

670


What is the flow of loading data into fact & dimensional tables?

593






How rejected rows are managed in datastage?

915


Distinguish between informatica & datastage. Which one would you choose and why?

578


Define data aggregation?

664


Hi guys, Please design a job for dis requirement with derivation(solution). my source table like dis. emp_no qualification 1 a 1 c 2 a 3 c 3 b To loaded to target like dis emp_no qualification 1 b 2 b 2 c 3 a my requirement is every employer have three qualifications i.e a,b and c. what qualification missed in source table that will be move to target systems. Hope u got it the requirement. Right Thanks.

2428


How do you schedule or monitoring the job?

664


Define ds designer?

766


Field,NVL,INDEX,REPLACE,TRANSLATE,COLESC

963


What is "fatal error/rdbms code 3996" error?

663


Difference between server jobs & parallel jobs?

648


What is process model?

1551