05-20-2009
How to search and replace a particular line in file with sed command
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 prod.
How do I achieve this with the sed or some other command.
Please help.
Thanks in advance.
Sam
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I am hoping someone can provide some guidance on using context based search and replace to search for a pattern and then do a search and replace in the line that follows it. For example, I have a file that looks like this:
<bold>bold text
</italic>
somecontent
morecontent... (3 Replies)
Discussion started by: charissaf67
3 Replies
2. Shell Programming and Scripting
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... (1 Reply)
Discussion started by: janzper
1 Replies
3. 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
4. Shell Programming and Scripting
Hello,
I would like to delete all the footnotes in all my htm files. Hence, I have to delete the whole font tag pairs, i.e. deleting everything between the begin/end font tags.
I create a testfile, of which data parts of all four lines are the same except for the number of font tag pairs,... (3 Replies)
Discussion started by: cibalo
3 Replies
5. Shell Programming and Scripting
Hi guys,
got a problem here with sed on the command line.
If i have a string as below:
online xx:wer:xcv: sdf:/asdf/http:https-asdfd
How can i match the pattern "http:" and replace the start of the string to the pattern with null?
I tried the following but it doesn't work:
... (3 Replies)
Discussion started by: DrivesMeCrazy
3 Replies
6. 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
7. Shell Programming and Scripting
my requirement is,
consider a file output
cat output
blah sdjfhjkd jsdfhjksdh
sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf
hellow there
this doesnt look good
et cetc etc
etcetera
i want to replace a line of line number 4 ("this doesnt look good") with some other line
... (3 Replies)
Discussion started by: vivek d r
3 Replies
8. Shell Programming and Scripting
All, I appreciate any help you can offer here as this is well beyond my grasp of awk/sed...
I have an input file similar to:
&LOG
&LOG Part: "@DB/TC10000021855/--F"
&LOG
&LOG
&LOG Part: "@DB/TC10000021852/--F"
&LOG Cloning_Action: RETAIN
&LOG Part: "@DB/TCCP000010713/--A"
&LOG
&LOG... (5 Replies)
Discussion started by: KarmaPoliceT2
5 Replies
9. Shell Programming and Scripting
Sed command to replace a line in a file using line number from the output of a pipe.
Is it possible to replace a whole line piped from someother command into a file at paritcular line...
here is some basic execution flow..
the line number is 412
lineNo=412
Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 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
DING(1) Debian GNU/Linux DING(1)
NAME
ding - dictionary lookup program for Unix
SYNOPSIS
ding [options] [phrase]
DESCRIPTION
ding is a dictionary lookup program for X Windows/Unix. It comes with a German-English dictionary with about 270,000 entries.
It is based on Tk version >= 8.3 and uses the agrep(1) or egrep(1) tools for searching.
In addition to this ding can also search using ispell(1) and dict(1).
It has many configuration options, such as search preferences, interface language (English or German), colors. It has history and help
functions and comes with useful key and mouse bindings for quick and easy lookups.
If you enter some word or phrase as command line argument, ding will start up with a translation of this word/phrase.
OPTIONS
-x, --selection
Start searching for selected word (X selection).
-m, --mini
Start with minimal size (search form only).
-r, --remote
Start search in an already running program.
-R, --remote-new
Start search in an already running program or start a new program.
--noconf
Do not save preferences
-D #, --debug #
Start with debug output, # = number (1..15).
USAGE
It's very simple: Start ding (via KDE menu "Tools" or via command line), type in search word, press ENTER, read results. Search further by
double-clicking a word, or select a word in another window and drop it by clicking with mouse button 2 over the "ding window". For further
information consult the program help by pressing F1.
SEE ALSO
agrep(1), egrep(1), ispell(1), ding(1).
http://www.tu-chemnitz.de/~fri/ding/
/usr/share/doc/ding/html/index.html
AUTHOR
ding was written by Frank Richter <frank.richter@hrz.tu-chemnitz.de>.
This manual page was written by Roland Rosenfeld <roland@spinnaker.de>, for the Debian GNU/Linux system (but may be used by others).
Debian Project March 2011 DING(1)