Sponsored Content
Full Discussion: Find and replace issue
Top Forums Shell Programming and Scripting Find and replace issue Post 302421164 by ygemici on Thursday 13th of May 2010 03:11:19 PM
Old 05-13-2010
MySQL

Quote:
Originally Posted by lokaish23
Hello
Thanks for the reply
ok what may be in the fiel is
Code:
soemdata&
mybaddata&
mygooddata&amp

Now what i want is
Code:
soemdata&amp
mybaddata&amp
mygooddata&amp

and it can be
Code:
soemdata&
mybaddata&
mygooddata&apos

so i need either replace with amp or apos like this
Code:
soemdata&amp
mybaddata&amp
mygooddata&amp

OR
Code:
soemdata&apos
mybaddata&apos
mygooddata&amp


i guess this will make sense.
Code:
 
 # cat data
soemdata&
mybaddata&
mygooddata&amp

Code:
 
# sed 's/\&.*$/\&amp/' data
soemdata&amp
mybaddata&amp
mygooddata&amp

Code:
# cat data
soemdata&
mybaddata&
mygooddata&apos

Code:
# sed -e 's/\&.*/\&amp/' data
soemdata&amp
mybaddata&amp
mygooddata&amp

or
Code:
 
# sed -e 's/\&/\&apos/' -e 's/\&aposapos/\&amp/' data
soemdata&apos
mybaddata&apos
mygooddata&amp

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find and replace

Hi, Iam new to shell script.How to write bourn shell script for find and replace. My requirement is: variable: name="abcd & co" i wanted to replace '&' with amp; plz suggest with out using sed. Thanks lot. (2 Replies)
Discussion started by: ram2s2001
2 Replies

2. UNIX for Dummies Questions & Answers

Help search and replace issue!

I have no idea really what I am doing but I am very good at copy-paste code from smart people :) I found it a while back but can't get it now, I am looking for a simple command line prompt command to search and replace text in multiple files. I have a website with a ton of pages and all links... (6 Replies)
Discussion started by: scavok
6 Replies

3. UNIX for Dummies Questions & Answers

Find and Replace

After running a command like grep -ir files2/ * This will find all the files that contain "files2/" in it. For example if it finds files2/dir/today files2/dir/yesterday files2/dir/2daysago Now it may find 100 instances, so is there a quick find and replace command I can use? I... (4 Replies)
Discussion started by: NycUnxer
4 Replies

4. Shell Programming and Scripting

replace issue with large files

I have the following problem: I have two files: S containing sentences (one in each row) and W containing files (one in each row). It might look like this: S: a b c apple d. e f orange g. h banana i j. W: orange banana apple My task is to replace in S all words that appear in W... (2 Replies)
Discussion started by: tootles564
2 Replies

5. Shell Programming and Scripting

find and replace issue using awk

Hi All, point 1. I have n number of environment variable files in different folders. All file names are ending with one thing common ie, *envset.sh point 2. All these contains Varilables and some other information like following *envset.sh ===>> ... (3 Replies)
Discussion started by: nitin.pathak
3 Replies

6. Shell Programming and Scripting

Perl newbie - regex replace all groups issue

Hello, Although I have found similar questions, I could not find advice that could help with my problem. The issue: I am trying to replace all occurrences of a regex, but I cannot make the regex groups work together. This is a simple input test file: The Vedanta Philosophy... (3 Replies)
Discussion started by: samask
3 Replies

7. Shell Programming and Scripting

to replace Date format issue

Hi, I have the below data in a file in one of the path, 101 02100002111406893401207310900A094101xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 5200xxxxxxxxxx D18000_1 CCDXXXXXXX JUL 31201207 1140689340000001 622113010547999999999003 000333333334RE ... (1 Reply)
Discussion started by: Ramyajiguru1
1 Replies

8. Shell Programming and Scripting

Find and replace..

Hi Experts.. I have requirement in which I have a text file say a.txt which looks like below: ASD 1 2 3 4 5 ASD 9 8 7 6 5 ASD 1 2 3 (5 Replies)
Discussion started by: Sathya83aa
5 Replies

9. Programming

Issue with replace

Hi, I have a problem with a replace of a pattern in a file. Example of file: CREATE TABLE TEST.TEST ( ID_SOGGETTO BIGINT NOT NULL, ENTE VARCHAR(64)) UNIQUE PRIMARY INDEX ( ID_SOGGETTO ,ENTE ); I want to replace the red pattern with another text: i want to replace the text after the... (6 Replies)
Discussion started by: mgazzato
6 Replies

10. Shell Programming and Scripting

Issue with sed command does not replace exact string matched

I have a file change.sed more change.sed I fire the below command inorder to replace "190.169.11.15" with "10.4.112.240" in proxy.logsed -f change.sed proxy.log proxy.log has the below entry more proxy.log The command replaces both 190.169.11.15 & 190.169.11.155 as below: I am expecting... (17 Replies)
Discussion started by: mohtashims
17 Replies
All times are GMT -4. The time now is 05:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy