top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can I translate these sed and perl one-liners to informatica?

+1 vote
62 views

the following commands have unique implementation in unix box.

Need to implement in informatica(etl tool). If not any windows solution for the same

sed 's/^#//g' < kam_account_calls.txt > kam_account_calls1.txt

perl -pi -e 's/#//' /coe/informatica/v712_OMJ/FAD/TgtFiles/C3i/CNTDEMO.csv

posted Jan 23, 2015 by Sachin

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Those two commands look quite similar and (at the same time) a bit strange.

Both look like they're trying to remove a line containing '#', but the first one will only remove a single '#' at the start of a line and the second will only remove a single '#' anywhere in the line - neither will remove the whole line!

What you probably want is either the Perl version or the sed version.

sed is a little more lightweight than Perl. You can get it for Windows.

The sed version of the command I'd expect to do what you want:
sed -i -e '/^#.*$/d' -e 's/[ \t]*#.*$//g' kam_account_calls.txt
That'll do the whole job in place. You'll need to use GNU sed for the "-i" (inplace) functionality. The above command turns this:

 a,b,c
 # a comment
 d,e,f
 # another comment
 g,h,i  # test comment
 j,k,l # test comment with space
into this:
 a,b,c
 d,e,f
 g,h,i
 j,k,l

Perl can do a similar thing for you, but it's a lot more heavyweight to install.

answer Jan 30, 2015 by Shweta Singh
Similar Questions
0 votes

I have a directory of files where each file is in one of three file formats. We can use the filename to determine the file format for mapping data. I would like to loop through all the files in the directory and based on the filename direct it towards the associated session mapping, delete the file on success, update the control table and then move to the next file. I'd like the execution to be deterministic. What are some of my options?

0 votes

Suppose if we have duplicate records in a table temp_n. Now I want to pass unique values to t1 and duplicate values to t2 in single mapping? How can we achieve?

...