05-28-2013
Find and substitute a string
Hi,
I started exploring unix recently. Now i have got a requirement like i have a input file where i am having some strings line by line (One string Might be single line or multiple lines). Now i need find these strings in another file and if its found i have to replace it with another string which comes from another input file. Please help me out how to do this... Should i use sed for this ??
Thanks in advance....
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I have an xml file which have several sections as the following:
<process-type id="NIR" module-id="OC4J">
<module-data>
<category id="start-parameters">
<data id="java-options" value="-server... (4 Replies)
Discussion started by: nir_s
4 Replies
2. Shell Programming and Scripting
Hi guys,
with sed when I need to make a substitution inside a line containing a specific keyword, I usually use:
sed '/keyword/ s/cat/dog/g'
This will substitute "cat" with "dog" on those lines containing "keyword". Now I want to use this inside vi, for several reason that I cannot... (2 Replies)
Discussion started by: lycaon
2 Replies
3. Shell Programming and Scripting
Suppose,
d=ABC*.BGH.LKJ
Now I want to replace 'DEFGHIJ' instead of '*.B' and store the value in d. Any Idea? Can we use sed here?
The outout should be like this:
d=ABCDEFGHIJGH.LKJ
Please help.. (4 Replies)
Discussion started by: Niroj
4 Replies
4. Shell Programming and Scripting
Hi,
I have a string like this user can specify different query sets that is why "or" is mentioned:
$string="](";
or
$string="]((";
or
$string="](((";
or
$string="]((((("; (1 Reply)
Discussion started by: vanitham
1 Replies
5. Shell Programming and Scripting
hi,
trying to learn more abt sed :(
i want to substitute a variable(a) with other variable(b) appended.
Read.txt contains:
home/test2/abc
home/test/root1
input.txt contains:
make test "home/test1/none"version="1.3"
wt's wrong test "home/test2/abc"version="1.0"
make save... (9 Replies)
Discussion started by: dragon.1431
9 Replies
6. Programming
I have a string like.
ATATATATTATTATATTATATTATT
I want to substitute the characters to "C" by using these locations
3 7
10 18
15 20
desired Output:
ATCCCCCTTACCCCCCCCCCTTATT
any clue will be great help. :wall:
thanks in advance. (2 Replies)
Discussion started by: admax
2 Replies
7. Shell Programming and Scripting
Objective is to substitute Jan with 01, Feb with 02 and so on. The month will be provided as input.
I could construct below awk and it worked.
echo Jun | \
awk 'BEGIN{split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec",mon," ")}{ for (i=1;i<=12;i++){ if ($1==mon) printf("%02d\n",i)} }'
... (4 Replies)
Discussion started by: krishmaths
4 Replies
8. Shell Programming and Scripting
Hi
I have 3 files in total. file 1 is enriched.txt file2 is repressed.txt and file 3 is my content.txt
What i need is query the content file against both enriched and repressed and wherever the gensymbol is same in both the files then add a yes value against it
file1
Gene
ABC
XYZ
MNO... (12 Replies)
Discussion started by: Diya123
12 Replies
9. Shell Programming and Scripting
I have large config-files for an application. The lines have different structure, but some of them contains the parameter 'TIMEOUT=x', where x is an numeric value. I want to change the value for that specific paramater if the value is greater than a specific value (got that?). The timeout-parameter... (3 Replies)
Discussion started by: useless
3 Replies
10. Shell Programming and Scripting
Dear all,
I try to replace a string of characters in a file (MyFile.txt) by a multiline value of the variable "Myvar":
$ cat MyFile.txt
DESCRIPTION '@TargetTable SCHEMA'
(
@InputFlowDef
);
$
The content of Myvar:
$ echo "$Myvar"
col1
, col2
, col3
$ (4 Replies)
Discussion started by: dae
4 Replies
LEARN ABOUT HPUX
xrmputlineresource
XrmPutLineResource() XrmPutLineResource()
Name
XrmPutLineResource - add a resource specification to a resource database.
Synopsis
void XrmPutLineResource(database, line)
XrmDatabase *database;
char *line;
Arguments
database Specifies a pointer to the resource database. If database contains NULL, a new resource database is created and a pointer to it
is returned in database. If a database is created, it is created in the current locale.
line Specifies the resource name (possibly with multiple components) and value pair as a single string, in the format resource:value.
Description
XrmPutLineResource() adds a single resource entry to the specified database. The line string is parsed in the locale of the database. If
the resource name is not in the Host Portable Character Encoding the result is implementation-dependent. Note that comment lines are not
stored.
XrmPutLineResource() is similar to XrmPutStringResource(), except that instead of having separate string arguments for the resource and its
value, XrmPutLineResource() takes a single string argument (line) which consists of the resource name, a colon, then the value. Since the
value is a string, it is stored into the database with representation type String.
Any whitespace before or after the name or colon in the line argument is ignored. The value is terminated by a new-line or a NULL charac-
ter. The value may contain embedded new-line characters represented by the "" and "n" two-character pair (not the single "
" character),
which are converted into a single linefeed character. In addition, the value may run over onto the next line; this is indicated by a ""
character at the end of each line to be continued.
Null-terminated strings without a new line are also permitted. XrmPutResource(), XrmQPutResource(), XrmPutStringResource(), XrmQPut-
StringResource() and XrmPutLineResource() all store data into a database. See XrmQPutResource() for the most complete description of this
process.
For more information, see Volume One, Chapter 13, Managing User Preferences.
Structures
XrmDatabase is a pointer to an opaque data type.
See Also
XrmDestroyDatabase(), XrmGetFileDatabase(), XrmGetResource(), XrmGetStringDatabase(), XrmInitialize(), XrmMergeDatabases(), XrmParseCom-
mand(), XrmPutFileDatabase(), XrmPutResource(), XrmPutStringResource(), XrmQGetResource(), XrmQGetSearchList(), XrmQGetSearchResource(),
XrmQPutResource(), XrmQPutStringResource(), XrmQuarkToString(), XrmStringToBindingQuarkList(), XrmStringToQuarkList(), XrmStringToQuark(),
XrmUniqueQuark().
Xlib - Resource Manager XrmPutLineResource()