How to remove ctrl M or(^M) characters in file using Sequential File stage?

Answers were Sorted based on User's Feedback



How to remove ctrl M or(^M) characters in file using Sequential File stage?..

Answer / subbuchamala

1) In Sequential file, we have an option like 'filter'.
in the filter we can mention like:
sed 's/\^M//g' FileName.txt

or
2) we can do this in Before job routine(executeSH) and we can cal this in Seq file stage. here we can use UNIX command 'unix2dos fileName.txt'

Is This Answer Correct ?    13 Yes 0 No

How to remove ctrl M or(^M) characters in file using Sequential File stage?..

Answer / subhash (subbuchamala)

We can use these ways also to remove Control M Characters

tr -d '\r' < yourfile.txt > yourfile1.txt
mv yourfile1.txt yourfile.txt

or

Change the line terminator in Sequential File stage from
UNIX-style to DOS-style(it's a stage property).

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More Data Stage Interview Questions

I/P --- ID Value 1 AB 2 ABC 3 ADE 4 A O/p --- ID Value 1 A 1 B 2 A 2 B 2 C 3 A 3 D 3 E 4 A

3 Answers   IBM,


Is it possible to implement parallelism in Mainframe Jobs ? If Yes how ? If no why ?

0 Answers   IBM,


What is the version control how can i apply this in DataStage can any one tell me the anser

4 Answers   IBM,


How do you register plug-ins?

0 Answers  


A flatfile contains 200 records.I want to load first 50 records at first time running the job,second 50 records at second time running and so on,how u can develop the job?pls give the steps?

3 Answers   TCS,






How can you join flat file, oracle as a sources?

4 Answers   IBM,


Why fact table is in normal form?

0 Answers  


explain about citrix scheduling tool in datastage

0 Answers   HSBC,


create a job that splits the data in the Jobs.txt file into four output files. You will direct the data to the different output files using constraints. • Job name: JobLevels • Source file: Jobs.txt • Target file 1: LowLevelJobs.txt &#8722; min_lvl between 0 and 25 inclusive. &#8722; Same column types and headings as Jobs.txt. &#8722; Include column names in the first line of the output file. &#8722; Job description column should be preceded by the string “Job Title:” and embedded within square brackets. For example, if the job description is “Designer”, the derived value is: “Job Title: [Designer]”. • Target file 2: MidLevelJobs.txt &#8722; min_lvl between 26 and 100 inclusive. &#8722; Same format and derivations as Target file 1. • Target file 3: HighLevelJobs.txt &#8722; min_lvl between 101 and 500 inclusive. &#8722; Same format and derivations as Target file 1. • Rejects file: JobRejects.txt &#8722; min_lvl is out of range, i.e., below 0 or above 500. &#8722; This file has only two columns: job_id and reject_desc. &#8722; reject_desc is a variable-length text field, maximum length 100. It should contain a string of the form: “Level out of range: <min_lvl>”, where <min_lvl> is the value in the min_lvl field. My Question is how do you write the stage variable for reject rows.

0 Answers   HCL,


If we take 2 tables(like emp and dept),we use join stage and how to improve the performance?

0 Answers  


I have the following columns in the EMP table Empid,Empname,Sal,month(Sal),year(Sal) and DOB(let us say the dob is 15th-Jan-1981) Desing a job such that the output contains the following empname,year(sal),tot(sal) and current age i.e. whether 18yrs or so on

1 Answers   Accenture,


What is Horizontal transformation, vertical transformation,diagonal transformation?

2 Answers   Cap Gemini,


Categories