02-19-2014
Quote:
Originally Posted by
sv0081493
Excellent mate it worked.Thanks
Could you please explain how its works and what is gsub
The
gsub() ( global substitution ) function returns the number of substitutions made, it's just summed up and printed in
END block.
This User Gave Thanks to Akshay Hegde For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
can some one help me with a perl command
i have to search and replace a version from a xml-file
so i use in a ksh script a command like this
ssh $GLB_ACC@$GLB_HOST "/usr/contrib/bin/perl -pi -e "s/$curVersion/$new_Version/g" $Dest_dir/epi.xml"
this command worked so far, but the problem... (1 Reply)
Discussion started by: kiranreddy1215
1 Replies
2. UNIX for Dummies Questions & Answers
My requirement is to replace a a particular pattren in a script from A to B.
I am not sure if this can be done through sed command or through awk .
The file sv.inc is
window DialogBox AddConnection
tag "~ActiveApp/Add Connection - Provider Type?URL"
I would wnat the file to be... (10 Replies)
Discussion started by: bsandeep_80
10 Replies
3. Shell Programming and Scripting
Frds
I have to search for a string which is starting with brighton which will be first in the line of a text file test1.txt. The contents of test1.txt are file names like
-----
brighton
brighton_gt
hst_brighton
gst_brighton
-------so many files------
---------
i have retrieve only... (3 Replies)
Discussion started by: KiranKumarKarre
3 Replies
4. Shell Programming and Scripting
I need to count the number of occurrences of a pattern, say 'key', between each occurrence of a different pattern, say 'lu'.
Here's a portion of the text I'm trying to parse:
lu S1234L_149_m1_vg.6, part-att 1, vdp-att 1 p-reserver IID 0xdb
registrations:
key 4156 4353 0000 0000
... (3 Replies)
Discussion started by: slipstream
3 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I am trying to find a particular patter in multiple UNIX files (also contain system files,hidden files and normal files)
i am now using
CMD: egrep -ali 'pattern' *
i am not getting the required result, i just need files path and finename
Naveen (3 Replies)
Discussion started by: Naveen_5960
3 Replies
6. Shell Programming and Scripting
Hi All,
Is it possible to count number of occurrences of a pattern in a single record using awk??
for example:
a line like this:
abrsjdfhafa
I want to count the number of a character occurrences. but still use the default RS, I don't want to set RS to single character. (1 Reply)
Discussion started by: ghoda2_10
1 Replies
7. UNIX for Dummies Questions & Answers
Hi all,
I have a TAB separated file like this:
sample.rpt:
54 67 common/bin/my/home {{bla bla bla}} {bla bla} Replace Me
89 75 bad/rainy/day/out {{ some bla} } {some bla} Dontreplace Me
......
......
I wish to do a regexp match on the 3rd... (2 Replies)
Discussion started by: newboy
2 Replies
8. Shell Programming and Scripting
Hi,
I want a help in this forum for my below issue.
1. I have a file where I'm searching for a text .
2. When I get the line where the above string is present I want to cut
some texts from the line where the particular string was found.
These above two steps will repeat in the... (2 Replies)
Discussion started by: bhaski2012
2 Replies
9. Shell Programming and Scripting
Hello everybody,
I use `case' quite a lot but , excellent as it is , it only gives one
final result ; can anyone suggest a way whereas , say long
lists of choices are given and I , or a user could select either one
two or any number of results to be echoed .
many thanks in... (3 Replies)
Discussion started by: V686
3 Replies
10. UNIX for Beginners Questions & Answers
Hi Friends ,
I am having one problem as stated file .
Having an input CSV file as shown in the code
U_TOP_LOGIC/U_HPB2/U_HBRIDGE2/i_core/i_paddr_reg_2_/Q,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0... (4 Replies)
Discussion started by: kshitij
4 Replies
LEARN ABOUT MOJAVE
tcl_substobj
Tcl_SubstObj(3) Tcl Library Procedures Tcl_SubstObj(3)
__________________________________________________________________________________________________________________________________________________
NAME
Tcl_SubstObj - perform substitutions on Tcl objects
SYNOPSIS
#include <tcl.h>
Tcl_Obj *
Tcl_SubstObj(interp, objPtr, flags)
ARGUMENTS
Tcl_Interp *interp (in) Interpreter in which to execute Tcl scripts and lookup variables. If an error occurs, the interpreter's
result is modified to hold an error message.
Tcl_Obj *objPtr (in) A Tcl object containing the string to perform substitutions on.
int flags (in) ORed combination of flag bits that specify which substitutions to perform. The flags TCL_SUBST_COM-
MANDS, TCL_SUBST_VARIABLES and TCL_SUBST_BACKSLASHES are currently supported, and TCL_SUBST_ALL is pro-
vided as a convenience for the common case where all substitutions are desired.
_________________________________________________________________
DESCRIPTION
The Tcl_SubstObj function is used to perform substitutions on strings in the fashion of the subst command. It gets the value of the string
contained in objPtr and scans it, copying characters and performing the chosen substitutions as it goes to an output object which is
returned as the result of the function. In the event of an error occurring during the execution of a command or variable substitution, the
function returns NULL and an error message is left in interp's result.
Three kinds of substitutions are supported. When the TCL_SUBST_BACKSLASHES bit is set in flags, sequences that look like backslash substi-
tutions for Tcl commands are replaced by their corresponding character.
When the TCL_SUBST_VARIABLES bit is set in flags, sequences that look like variable substitutions for Tcl commands are replaced by the con-
tents of the named variable.
When the TCL_SUBST_COMMANDS bit is set in flags, sequences that look like command substitutions for Tcl commands are replaced by the result
of evaluating that script. Where an uncaught "continue exception" occurs during the evaluation of a command substitution, an empty string
is substituted for the command. Where an uncaught "break exception" occurs during the evaluation of a command substitution, the result of
the whole substitution on objPtr will be truncated at the point immediately before the start of the command substitution, and no characters
will be added to the result or substitutions performed after that point.
SEE ALSO
subst(n)
KEYWORDS
backslash substitution, command substitution, variable substitution
Tcl 8.4 Tcl_SubstObj(3)