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
How to reverse the string using unix?
What is size of a transaction and an array means in a datastage?
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.
What are stage variables, derivations and constants?
How do u convert the columns to rows in datastage?
How do you import and export data into datastage?
Where do you see different stages in the designer?
explain about completely flow of sequencers technicaly,without using example??explain about lookup,nullhandling?
What are the enhancements made in datastage 7.5 compare with 7.0?
What is the difference between datastage and datastage tx?
how to connect source to db?generally what r stages u used? how to find the data is having delimiter format?
What are the types of hashed files in data stage
How to Remove Duplicate using SQL?
How to read multiple files using a single datastage job if files have the same metadata?
Whats difference betweeen operational data stage (ods) and data warehouse?