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
A signal has a wavelength of 1 micro min in air.how far can the front of the wave travel during 1000periods?
Which warehouse using in your datawarehouse
which r the connectors used in san?
how to implement scd2 in datastage 7.5 with lookup stage
Can you filter data in hashed file?
What are stage variables and constants?
Why we use surrogate key?
hi.... am facing typical problem in every interview " I need some critical scenarios faced in real time" plz help me guys
How many types of hash files are there?
What are the types of jobs we have in datastage?
Which is the best institute in Hyderabad to learn OBIEE and DataStage?Please tell me faculty name also
Is possible to create skid in dim,fact tables?
Describe the architecture of datastage?
How a source file is populated?
how to write server Routine coding?