Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Append a particular string after occurrence of particular string. Post 303039538 by ram0106 on Wednesday 9th of October 2019 05:17:48 AM
Old 10-09-2019
Append a particular string after occurrence of particular string.

Hi Friends,

Good morning.

Appended a particular string after occurrence of particular string in a file.

my file abc.sql as below

Code:
create or replace  function f1(p_cust_no IN VARCHAR)
RETURN number IS
DECLARE
v_country country.customer_tbl%TYPE;	
    begin
    	begin
	    select country
	    into v_country
	    from customer_tbl;

exception
when others
then
bbk.createmsg(MST.notexisted(),'notexisted',p_cust_no);
pfg := false;
				
v_msgtext := bbk.createmsg(MST.isterminated(),
                                      'isterminated',
    	    	    	    	       v_gst,
    	    	    	    	       v_country,
                                      p_cust_no);
							  
pfg := false;				
			
 	    v_msgtext := bbk.createmsg(MST.isterminated(),
                                      'isterminated',
    	    	    	    	      v_cgst,
    	    	    	    	       v_country,
                                      p_cust_no);
								  
pfg := false;			

end;

In the given input file Where ever is bbk.createmsg existed in that after second occurrence of ",". Every thing should be appended with tstcre.noconvert().

The expected output would be

Code:
bbk.createmsg(MST.notexisted(),'notexisted',tstcre.noconvert(p_cust_no));

v_msgtext := bbk.createmsg(MST.isterminated(),
                                      'isterminated',
    	    	    	    	       tstcre.noconvert(v_gst),
    	    	    	    	       tstcre.noconvert(v_country),
                                      tstcre.noconvert(p_cust_no));
							  
v_msgtext := bbk.createmsg(MST.isterminated(),
                                      'isterminated',
    	    	    	    	      tstcre.noconvert(v_cgst),
    	    	    	    	       tstcre.noconvert(v_country),
                                      tstcre.noconvert(p_cust_no));

Please help me .
Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search a string and append text after the string

Hi, I have a file like this... <o t="Batch" id="8410" p="/" g="32"> <a n="name"> <v s="DBBA1MM"/> </a> <a n="owner"> <v r="/Administrator"/> </a> <a n="rights"> <v s="95"/> </a> <a n="debugLevel"> <v s="3"/> </a> <a n="avsStoreLoc"> <v... (8 Replies)
Discussion started by: kesu2k
8 Replies

2. Shell Programming and Scripting

Displaying only First Occurrence of a String

Hi, My requirement is that I should search for a particular string and display the string only once if there is more occurrence of the same string in a file. e.g In the given below log file,the string AMQ5037 comes twice.I want to search for this string and display it only once.grep will... (5 Replies)
Discussion started by: charudpss
5 Replies

3. Shell Programming and Scripting

remove characters from string based on occurrence of a string

Hello Folks.. I need your help .. here the example of my problem..i know its easy..i don't all the commands in unix to do this especiallly sed...here my string.. dwc2_dfg_ajja_dfhhj_vw_dec2_dfgh_dwq desired output is.. dwc2_dfg_ajja_dfhhj it's a simple task with tail... (5 Replies)
Discussion started by: victor369
5 Replies

4. UNIX for Dummies Questions & Answers

Append a string on the next line after a pattern string is found

Right now, my code is: s/Secondary Ins./Secondary Ins.\ 1/g It's adding a 1 as soon as it finds Secondary Ins. Primary Ins.: MEDICARE B DMERC Secondary Ins. 1: CONTINENTAL LIFE INS What I really want to achieve is having a 1 added on the next line that contain "Secondary Ins." It... (4 Replies)
Discussion started by: newbeee
4 Replies

5. Shell Programming and Scripting

Append a searched string with another string using sed

Hi, I need to replace and append a string in a text if grep is true. For eg: grep ABC test.txt | grep -v '\.$' | awk {'print $4'} | sed "s/ ? How do I replace all instances of "print $4" using sed with another sring? Eg of the string returned will be, lx123 web222 xyz Want to... (8 Replies)
Discussion started by: vchee
8 Replies

6. Shell Programming and Scripting

How to append a string by comparing another string?

Hi , I have one file like BUD,BDL BUDCAR BUD,BDL BUDLAMP ABC,CDF,KLT ABISKAR ABC,CDF,KLT CORNEL ABC,CDF,KLT KANNAD JKL,HNM,KTY,KJY JAGAN JKL,HNM,KTY,KJY HOUSE JKL,HNM,KTY,KJY KATAK JKL,HNM,KTY,KJY KOLKA The o/p should be like BUD,BDL BUDCAR,BUDLAMP ABC,CDF,KLT... (4 Replies)
Discussion started by: jagdishrout
4 Replies

7. Shell Programming and Scripting

How to append string checking other same string?

Hi , I have a file likeA-0044150|ABC/Frito/ A-0044150|GFHU A-0150075|Bud Racing A-0187811|Bud Light A-0187811|RW&B signmaking I Want the o/p likeA-0044150|ABC/Frito/,GFHU A-0150075|Bud Racing A-0187811|Bud Light,RW&B signmaking (2 Replies)
Discussion started by: jagdishrout
2 Replies

8. Shell Programming and Scripting

Find a string occurrence if twice in a line

Hello All, I want to check if a delimiter is existing twice in a line of a text file. Suppose flat file is like this 234 | 123 123 | 345 456 | 563 | 234 | 548 So the the 3rd line has two delimiters, How can we find the lines in such a file having more then one delimiters I tried... (5 Replies)
Discussion started by: nnani
5 Replies

9. Shell Programming and Scripting

Find string in file and append new string after

Hi All, I'm trying to insert a string into a file at a specific location. I'd like to add a string after the parent::__construct(); in my file. <?php if (! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Controller extends CI_Controller { function... (6 Replies)
Discussion started by: jjkilpatrick
6 Replies

10. Shell Programming and Scripting

[Solved] Last occurrence of a string

I apologize if it was asked before but I couldn't find something related. I want to replace 2 strings in a file e.g pwddb=Lar1wod (need to replace string after =) pwdapp=Wde2xe (need to replace string after =) AND in same file want to find last occurrence of a string (SR2-134561),... (2 Replies)
Discussion started by: J_ang
2 Replies
MBRUNE(3)						   BSD Library Functions Manual 						 MBRUNE(3)

NAME
mbrune, mbrrune, mbmb -- multibyte rune support for C LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <rune.h> char * mbrune(const char *string, rune_t rune); char * mbrrune(const char *string, rune_t rune); char * mbmb(const char *string, char *pattern); DESCRIPTION
The 4.4BSD ``rune'' functions have been deprecated in favour of the ISO C99 extended multibyte and wide character facilities and should not be used in new applications. Consider working with wide characters instead, and using wcschr(3), wcsrchr(3), and wcsstr(3) instead of these functions. These routines provide the corresponding functionality of strchr(), strrchr() and strstr() for multibyte strings. The mbrune() function locates the first occurrence of rune() in the string pointed to by string. The terminating NUL character is considered part of the string. If rune is '', mbrune() locates the terminating ''. The mbrrune() function locates the last occurrence of rune in the string string. If rune is '', mbrune() locates the terminating ''. The mbmb() function locates the first occurrence of the null-terminated string pattern in the null-terminated string string. If pattern is the empty string, mbmb() returns string; if pattern occurs nowhere in string, mbmb() returns NULL; otherwise mbmb() returns a pointer to the first character of the first occurrence of pattern. RETURN VALUES
The function mbrune() returns a pointer to the located character, or NULL if the character does not appear in the string. The mbrrune() function returns a pointer to the character, or NULL if the character does not appear in the string. The mbmb() function returns a pointer to the pattern, or NULL if the pattern does not appear in the string. SEE ALSO
rune(3), setlocale(3), euc(4), utf2(4), utf8(5) HISTORY
The mbrune(), mbrrune(), and mbmb() functions first appeared in Plan 9 from Bell Labs as utfrune(), utfrrune(), and utfutf(). BSD
April 19, 1994 BSD
All times are GMT -4. The time now is 07:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy