01-26-2009
sed search and replace command
Hi,
I would like to seek help on how i can arrive on this result.
sample.txt:
product_code IN (param001) and product_type IN (param004)
product_code IN (param002) and product_type IN (param005)
product_code IN (param003) and product_type IN (param006)
I would like to change the param001 to 'RB23','J'
I tried this command in sed but it has error.
$ sed 's/param001/'RB23','J'/g' sample.txt > sample.out
output should be:
product_code IN ('RB23','J') and product_type IN (param004)
I am new to sed and it would be nice if you can help me on this. Thanks in advance.
Thanks!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi folks,
I need to search and replace specific text in a file and replace it. I have a text file that does not have any newlines or carriage returns. All newlines have been removed. Here is what I need to do.
Find the exact string “DH” (quotes included) and replace it with \n”DH” (basically... (6 Replies)
Discussion started by: bridgeje
6 Replies
2. UNIX for Dummies Questions & Answers
Hello Folks,
Anyone know how I can replace this line in file.xml
<oacore_nprocs oa_var="s_oacore_nprocs">8</oacore_nprocs>
with this line
<oacore_nprocs oa_var="s_oacore_nprocs">1</oacore_nprocs>
using sed or awk ?
Thanks for your time.
Cheers,
Dave (7 Replies)
Discussion started by: d__browne
7 Replies
3. UNIX for Dummies Questions & Answers
Is there a way to use the sed command to
1) search a specified pattern
2) in the line where that pattern is found, replace from character N to character N+4 with a new 4-character string.
Thks in advance! (5 Replies)
Discussion started by: mvalonso
5 Replies
4. UNIX for Dummies Questions & Answers
Hi
I am very new to linux and scripting.
I need to replace numbers abc with number xyz inputting from a reference file.
I used the following command -
sed "s/$grd/$lab/" , where $grd and $lab comes from reference file.
The problem is the above line doesnt take care of space..... (1 Reply)
Discussion started by: ajayh
1 Replies
5. UNIX for Dummies Questions & Answers
Hello,
I have a file and in that, I want to search for a aprticular word and then replace another word in the same line with something else.
Example: In file abc.txt, there is a line
<host oa_var="s_hostname">test</host>
I want to search with s_hostname text and then replace test with... (2 Replies)
Discussion started by: sshah1001
2 Replies
6. Shell Programming and Scripting
hi,
im new for sed, anyone can help me to these in sed command
my output file.txt
"aaa",a1,bbb
"ddd",a1,ccc
"eee",a1,www
need to change a1, to "a1","
output i need
"aaa","a1","bbb
"ddd","a1","ccc
"eee","a1","www
thanks in advance
fsp (2 Replies)
Discussion started by: fspalero
2 Replies
7. UNIX for Dummies Questions & Answers
Hello -
I have a very large file in which a certain numbers are repeated. I find that using vi to edit the entire file is useless.
How should i use sed to find a replace such as this text:
To replace: 145.D25.D558
With: 215.22.45.DW
I tried this command:
sed... (4 Replies)
Discussion started by: DallasT
4 Replies
8. Shell Programming and Scripting
hi,
suggest me in the below script..
if
In above I wanna replace "" with "]". (2 Replies)
Discussion started by: divya bandipotu
2 Replies
9. Shell Programming and Scripting
Hi guys, thanks for accepting me in your forum .. I am trying to clean some hacked PHP files using SSH .. I am using this command:
find . -type f -print0 | xargs -0 sed -i '/god_mod/d'
<?php ... (3 Replies)
Discussion started by: wisam74us
3 Replies
10. Shell Programming and Scripting
how to search and replace string in column in file with command sed or other
search "INC0000003.in" and replace column 4 = "W"
$ cat file.txt
INC0000001.in|20150120|Y|N|N
INC0000002.in|20150120|Y|N|N
INC0000003.in|20150120|Y|N|N
INC0000004.in|20150120|Y|N|Noutput... (4 Replies)
Discussion started by: ppmanja3
4 Replies
LEARN ABOUT DEBIAN
netris-sample-robot
netris-sample-robot(6) Netris Sample Robot netris-sample-robot(6)
NAME
netris-sample-robot - sample robot for netris
SYNOPSIS
netris-sample-robot [-l]
DESCRIPTION
The netris-sample-robot is a sample implementation of the robot protocol. It plays quite well but isn't too hard to beat. The robot should
be started from netris with the option -r to connect or wait for another player to join. You can also let two robots play against each
other in that way, if you like.
OPTIONS
-l Writes some log information into the file log in the current working directory. If it can't it bails out.
EXAMPLES
To start the netris-sample-robot waiting for another connection with logfile use the following line:
netris -w -r 'netris-sample-robot -l'
You then just have to start netris somewhere else which connects to that robot.
SEE ALSO
netris(6)
BUGS
One known bug of the netris-sample-robot is that it hangs quite often. This was already filed as a bugreport against the package so please
refrain from doing so again. If you have an idea why this happens or know a solution how to fix it feel free to mail us.
AUTHORS
Netris was written by Mark H. Weaver <mhw@netris.org>.
This manual page was written by Gerfried Fuchs <alfie@debian.org> for the Debian GNU/Linux system (but may be used by others).
0.5 16 Feb 2002 netris-sample-robot(6)