Add the code above searching string


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Add the code above searching string
# 1  
Old 06-06-2013
Add the code above searching string

Hi Team,

I have one requirement.

i have to add the code from file1.txt to file2.txt. based on searching string in file2.txt
Conditions:
1) we have to add the code after and before searching string.
2) if the searching string find 3 times , we have to add the code after and before searching string.
# 2  
Old 06-06-2013
Hard to understand requirements

Please provide examples of before and after.
# 3  
Old 06-06-2013
This sounds much like a continuation of your other thread...
# 4  
Old 06-06-2013
What have you tried so far?
# 5  
Old 06-06-2013
we have to Search For <corecomEBO:RevisedBillOfMaterials> in file3.txt

below code add above to <corecomEBO:RevisedBillOfMaterials>
file1.txt:

<!--SGI : BOM Primary Org Customization Begin -->
<xsl:variable name="varBOMPrimaryOrg">
<xsl:if test="./changeABO:AffectedItem/changeABO:PageTwo/List20">
<xsl:value-of select="./changeABO:AffectedItem/changeABO:PageTwo/List20"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$varOrganizationCode= $varBOMPrimaryOrg">
<!--SGI : BOM Primary Org Customization End-->




Search For </corecomEBO:RevisedBillOfMaterials>
After this ,add below piece of code


file2.txt

<!--SGI : BOM Primary Org Customization Begin -->
</xsl:when>
<xslSmilietherwise>
<corecomEBO:RevisedBillOfMaterials/>
</xslSmilietherwise>
</xsl:choose>
<!--SGI : BOM Primary Org Customization End-->
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

How to add a new string at the end of line by searching a string on the same line?

Hi, I have a file which is an extract of jil codes of all autosys jobs in our server. Sample jil code: ************************** permission:gx,wx date_conditions:yes days_of_week:all start_times:"05:00" condition: notrunning(appDev#box#ProductLoad)... (1 Reply)
Discussion started by: raghavendra
1 Replies

2. Shell Programming and Scripting

Adding the code after searching the string

Hi All, please suggest me.. How to add the text from one file to another file and need to add the code after 3 lines of below searched line . sample code in standard file: <corecom:Description xml:id="id_2607"> <xsl:value-of... (6 Replies)
Discussion started by: vijayko
6 Replies

3. Shell Programming and Scripting

Searching for a string using loop.

Hi i am very new to shell scripting. I have got stuck on a portion on my script. Problem : I have 30 logfiles inside /home/test directory. I need to find the string "@ended today" in all the 30 logfiles and print the name of the files which did not have this string. i need to this by... (3 Replies)
Discussion started by: Soma Das
3 Replies

4. Shell Programming and Scripting

Searching a String

Hi everyone ! suppose i'm searching for a specific string in a file so it is very easy, i use the following command grep 'keyword' file_name but how to search a word which is repeated maximum number of times in a file, for example in the following text i have to search a word which is... (12 Replies)
Discussion started by: ourned
12 Replies

5. Shell Programming and Scripting

searching the required string and appending string to it.

Hi all, I have some data in the form of adc|nvhs|nahssn|njadnk|nkfds in the above data i need to write a script so thet it will append "|||" to the third occurnace in the string ..... the outout should look like adc|nvhs|nahssn||||njadnk|nkfds Thanks, Firestar. (6 Replies)
Discussion started by: firestar
6 Replies

6. Shell Programming and Scripting

searching a text string for n'th :

hello, i'm a novice on bsh scripting so thanks for any help here basically i have a shell var $x that looks like this > echo $x nabc1234:!:73394:17155:Gary Mason:/home/garym:/bin/ksh and i'm trying to keep the first 8 characters and the text from the 4th : to the 5th : i've been trying... (9 Replies)
Discussion started by: sasglm
9 Replies

7. Shell Programming and Scripting

searching each file for a string

Hi Guys... I want to search for each file that contains a particular string. e.g find . -print | xargs grep -i string_name Now my issue is the files that I search in are gzipped. Will I be able to find the string, using the above commands, even if the files are gzipped? Please... (2 Replies)
Discussion started by: Phuti
2 Replies

8. Shell Programming and Scripting

Extracting a string from one file and searching the same string in other files

Hi, Need to extract a string from one file and search the same in other files. Ex: I have file1 of hundred lines with no delimiters not even space. I have 3 more files. I should get 1 to 10 characters say substring from each line of file1 and search that string in rest of the files and get... (1 Reply)
Discussion started by: mohancrr
1 Replies

9. UNIX for Dummies Questions & Answers

searching by string length

Hi, I'm rather new to Unix and I'm trying to write a simple script to search through a dictionary for words based on the letters a user would pass as arguments to the script. Now I have the searching part done. However, the one thig that still eludes me is that I want to only keep the... (4 Replies)
Discussion started by: GADO
4 Replies

10. UNIX for Dummies Questions & Answers

searching for a string in directory

Hi, I have a directory with a couple of thousand logs in it. The log files are created every 5 minutes. I want to search these logs grep for a specific sting and more importantly print the name of the files where that sting was found. e.g. all logs begin om20020927 what I have been... (4 Replies)
Discussion started by: warrend
4 Replies
Login or Register to Ask a Question