0

I have a document containing 100's of lines as show below.

 fn:concat(xs:float("-3.4028235E38"),xs:float("3.4028235E38"))
 fn:concat(xs:int("-1873914410"),xs:int("-2147483648"))
 fn:concat(xs:int("-1873914410"))

I'd like to get something like this

fn.concat(-3.4028235E38,3.4028235E38);
fn.concat(-1873914410,-2147483648);
fn.concat(-1873914410);

Thank you. Your time is appreciated!

4
  • did you mean to change fn:concat to fn.concat? Commented Apr 2, 2014 at 0:53
  • I want fn:concat() to be there, only fn:float() and fn:int() to be gone from each line Commented Apr 2, 2014 at 0:59
  • You'll notice in your original file, it has a colon in fn:concat where your goal has a period in fn.concat. I take it that's a mistype. Commented Apr 2, 2014 at 1:13
  • sorry i overlooked the .. Yes I do need to convert to fn.concat() Commented Apr 2, 2014 at 1:14

1 Answer 1

1

in a quick and dirty one liner

perl -i -pe 's/\bxs:(?:float|int)\("(.*?)"\)/$1/g; s/(?<=\w):(?=\w)/./g;' file
Sign up to request clarification or add additional context in comments.

6 Comments

Thank you! that works. On the side note, could you also please share the solution to get rid of the double quotes along with above regex as well?
Edited to remove double quotes as well.
Edited to translate colon to period in fn:concat
how to make fn:concat replacement dynamic. Basically I'd like to replace all functions that has colon : to dot .
are they always prefixed with fn?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.