SET lv_process_str = SUBSTRING(lv_process_str FROM 1 FOR POSITION(in_search_str IN lv_process_str)-1 ) ||in_replace_str||SUBSTRING(lv_process_str FROM POSITION(in_search_str IN lv_process_str)+1 FOR CHARACTER_LENGTH(lv_process_str)-1);

This command counts the lines in an example.txt text file, removes the formatting and prints only the number of lines. We need to replace all pipes (2) with 'xxx'; the first one is not a pipe, it is an l (L).