07-22-2015
Apologies I forgot tags. It works as expected. Many thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm new to Unix scripting and I'm not sure if this can be done. Example:
search (grep) in a file for 'Control ID' and then replace with 4 blanks 7 bytes before 'Control ID.
input
"xxxxxx1234xxxxxxxControl IDxxxxxx"
output:
"xxxxxx xxxxxxxControl IDxxxxxx"
thanks! (7 Replies)
Discussion started by: jbt828
7 Replies
2. Shell Programming and Scripting
Hi Everyone,
I am new to this forum and new to sed/awk programming too !!
I need to find particular string in file1(text file) and replace it with a value from another text file(file2) the file2 has only one line and the value to be replaced with is in the second column.
file 1:
(assert (=... (21 Replies)
Discussion started by: paramad
21 Replies
3. Shell Programming and Scripting
Can someone tell me how I can do this?
e.g:
a=$(echo -e wert trewt ertert ertert ertert erttert
erterte
rterter
tertertert
ert)
How do i replace the STRING with $a?
I try this:
sed -i 's/STRING/'"$a"'/g' filename.ext
but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies
4. Shell Programming and Scripting
QUESTION1:
How do you grep only an exact string. I am using Solaris10 and do not have any GNU products installed.
Contents of car.txt
CAR1_KEY0
CAR1_KEY1
CAR2_KEY0
CAR2_KEY1
CAR1_KEY10
CURRENT COMMAND LINE: WHERE VARIABLE CAR_NUMBER=1 AND KEY_NUMBER=1
grep... (1 Reply)
Discussion started by: thibodc
1 Replies
5. Shell Programming and Scripting
Hi All,
I have a file in which contains location of various data files. I want to change locations using sed. Find and replace strings are in a separate file. Content of this file (/tmp/tt) -
/dd/pp/test/test/1/ /pp/aa/test/dg1/
/dd/pp/test/test/2/ /pp/aa/test/dg2/
/dd/pp/test/test/3/... (2 Replies)
Discussion started by: pandeyra
2 Replies
6. Shell Programming and Scripting
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
7. Shell Programming and Scripting
Hi,
Here's my dilemma.
I need to replace the string Sept_2012 to Oct_2012 in all *config.py files within the current directory and below directories
Is this possible?
Also I am trying to find all instances of the string Sept_2012 within files in the current directory and below
I have... (13 Replies)
Discussion started by: pure_jax
13 Replies
8. Shell Programming and Scripting
I have a file example.txt as follows :SomeTextGoesHere
$$TODAY_DT=20140818
$$TODAY_DT=20140818
$$TODAY_DT=20140818I need to automatically update the date (20140818) in the above file, by getting the new date as argument, using a shell script.
(It would even be better if I could pass... (5 Replies)
Discussion started by: SriRamKrish
5 Replies
9. UNIX for Beginners Questions & Answers
Hi Everyone,
I have a xml file, where i need to find this
HOST=dbhost.domain.com
and then replace only
dbhost.domain.com with db.one.in
so finally it should like this
HOST=db.one.in
i tried this but its not working.
sed -i "s/^HOST=*com$/HOST=db.one.in/g" repository.xml
^... (4 Replies)
Discussion started by: shajay12
4 Replies
10. UNIX for Beginners Questions & Answers
I need to find and replace a date format in a SQL script with sed. The original lines are like this:
ep.begin_date, ep.end_date, ep.facility_code,
AND ep.begin_date <= '01-JUL-2019'
ep.begin_date, ep.end_date, ep.facility_code,
AND ... (15 Replies)
Discussion started by: duke0001
15 Replies
LEARN ABOUT CENTOS
replace
REPLACE(1) MySQL Database System REPLACE(1)
NAME
replace - a string-replacement utility
SYNOPSIS
replace arguments
DESCRIPTION
The replace utility program changes strings in place in files or on the standard input.
Invoke replace in one of the following ways:
shell> replace from to [from to] ... -- file_name [file_name] ...
shell> replace from to [from to] ... < file_name
from represents a string to look for and to represents its replacement. There can be one or more pairs of strings.
Use the -- option to indicate where the string-replacement list ends and the file names begin. In this case, any file named on the command
line is modified in place, so you may want to make a copy of the original before converting it. replace prints a message indicating which
of the input files it actually modifies.
If the -- option is not given, replace reads the standard input and writes to the standard output.
replace uses a finite state machine to match longer strings first. It can be used to swap strings. For example, the following command swaps
a and b in the given files, file1 and file2:
shell> replace a b b a -- file1 file2 ...
The replace program is used by msql2mysql. See msql2mysql(1).
replace supports the following options.
o -?, -I
Display a help message and exit.
o -#debug_options
Enable debugging.
o -s
Silent mode. Print less information what the program does.
o -v
Verbose mode. Print more information about what the program does.
o -V
Display version information and exit.
COPYRIGHT
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as
published by the Free Software Foundation; version 2 of the License.
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online
at http://dev.mysql.com/doc/.
AUTHOR
Sun Microsystems, Inc. (http://www.mysql.com/).
MySQL 5.1 04/06/2010 REPLACE(1)