Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Pattern Matching - serach and replace script Post 302304669 by bsandeep_80 on Tuesday 7th of April 2009 04:36:05 AM
Old 04-07-2009
Pattern Matching - serach and replace script

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
Code:
[+] window DialogBox  AddConnection
   [ ] tag "~ActiveApp/[DialogBox]Add Connection - Provider Type?URL"

I would wnat the file to be displaced as below after it matched the pattern
Code:
 [+] window DialogBox  AddConnection
   [ ] tag stAddConnection

If you note the pattern "~ActiveApp/[DialogBox]Add Connection - Provider Type?URL" has been replaced by stAddConnection

Please help

Last edited by Yogesh Sawant; 04-07-2009 at 05:42 AM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

serach and replace a specific pattern or value in a xml file

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

Serach a pattern

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

3. Shell Programming and Scripting

Need help to replace a perl pattern matching

My example file is as given below: conn=1 uid=oracle conn=2 uid=db2 conn=3 uid=oracle conn=4 uid=hash conn=5 uid=skher conn=6 uid=oracle conn=7 uid=mpalkar conn=8 uid=anarke conn=9 uid=oracle conn=1 op=-1 msgId=-1 - fd=104 slot=104 LDAPS connection from 10.10.5.6 to 10.18.6.5 conn=2... (4 Replies)
Discussion started by: sags007_99
4 Replies

4. UNIX for Dummies Questions & Answers

Serach pattern in one field and replace in another

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

5. Shell Programming and Scripting

sed to replace the matching pattern with equal number of spaces

Hi I have written a shell script which used sed code below sed -i 's/'"$Pattern"'/ /g' $FileName I want to count the length of Pattern and replace it with equal number of spaces in the FileName. I have used $(#pattern) to get the length but could not understand how to replace... (8 Replies)
Discussion started by: rakeshkumar
8 Replies

6. Shell Programming and Scripting

Script to Serach pattern and give number of occurrences

Hi, I want a script which search for a pattern "good" in a huge file and provide me number of occurences of such pattern in a file. lets say i have a file test.txt contents as below good is good but good is sometime bad and sometime good you are very good and good is always good ... (7 Replies)
Discussion started by: sv0081493
7 Replies

7. Shell Programming and Scripting

Pattern matching and replace in shell script

Hi I want to find a line in a file which contains a word and replace the patterns. Sample file content temp.xml ==================== <applications> <application> Name="FirstService" location="http://my.website.selected/myfirstService/V1.0/myfirst.war" ... (1 Reply)
Discussion started by: sakthi.99it
1 Replies

8. Shell Programming and Scripting

sed - Exact pattern matching and replace

Hi Team, I am facing a problem as under, Suppose I have a file (test.txt) with the below content (all braces and slashes are included in the contents of the file) Now I want to append few words below matched line, I have written the below sed: sed '/option/a insert text here' test... (2 Replies)
Discussion started by: ankur328
2 Replies

9. Shell Programming and Scripting

Replace pattern matching

Can anyone help me with sed or awk to do a bulk replace of the below requirements. "REC_ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY ( START WITH +7486 INCREMENT BY +1 MINVALUE +7467 MAXVALUE... (6 Replies)
Discussion started by: ilugopal
6 Replies

10. Shell Programming and Scripting

Replace String matching wildcard pattern

Hi, I know how to replace a string with another in a file. But, i wish to replace the below string pattern EncryptedPassword="{gafgfa}]\asffafsf312a" i.e EncryptedPassword="<any random string>" To EncryptedPassword="" i.e remove the random password to a empty string. Can you... (3 Replies)
Discussion started by: mohtashims
3 Replies
DialogBox(3)						User Contributed Perl Documentation					      DialogBox(3)

NAME
Tk::DialogBox - create and manipulate a dialog screen. SYNOPSIS
use Tk::DialogBox ... $d = $top->DialogBox(-title => "Title", -buttons => ["OK", "Cancel"]); $w = $d->add(Widget, args)->pack; ... $button = $d->Show; DESCRIPTION
DialogBox is very similar to Dialog except that it allows any widget in the top Frame. DialogBox creates two Frames, top and bottom. The bottom Frame shows all the specified Buttons, lined up from left to right. The top Frame acts as a container for all other widgets that can be added with the add() method. OPTIONS
The options recognized by DialogBox are as follows: -title Specify the title of the DialogBox. If this is not set, then the name of the program is used. -buttons The button names to display in the bottom Frame. This is a reference to an array of strings containing the text to put on each Button. There is no default value for this. If you do not specify any button names, no Buttons are displayed. -default_button Specifies the default Button that is considered invoked when user presses <Return> on the DialogBox. This Button is highlighted. If no default Button is specified, then the first element of the array whose reference is passed to the -buttons option is used as the default. -cancel_button Specifies the Button that is considered invoked when the user closes the DialogBox using the window manager's close button. If the -cancel_button option is not given, and if there's only one button configured, then this button is also used as the cancel button. Otherwise no button is considered as the cancel button; in such a case Show just returns "undef" when the user closes the DialogBox. -command A callback which is executed after invoking an action to close the DialogBox, but before restoring focus and grab information. The selected button is passed as the first argument. -focus Specify the widget to receive the initial focus after popping up the DialogBox. By default the -default_button widget receives the initial focus. -showcommand A callback which is executed before displaying the DialogBox and waiting for user input. The DialogBox itself is passed as the first argument. METHODS
DialogBox supports only two methods as of now: add(widget, options) Add the widget indicated by widget. Widget can be the name of any Tk widget (standard or contributed). options are the options that the widget accepts. The widget is advertized as a subwidget of DialogBox. The name of widget is lower-cased and used as the advertised name. If multiple instances of widget are created in the DialogBox, then only the last one gets the advertised name. add() does not automatically pack() or grid() widget into the DialogBox. Show(?-global?) Displays the Dialog until the user invokes one of the Buttons in the bottom Frame. If the grab type -global is specified, then Show uses that grab; otherwise it defaults to a local grab. Returns the name of the Button invoked. The actual Dialog is shown using the Popup method. Any other options supplied to Show are passed to Popup, and can be used to position the Dialog on the screen. Please read Tk::Popup for details. Exit() Close the dialogbox, by emulating a click on the default button. ADVERTISED WIDGETS
top The subwidget reference to the top half of the DialogBox widget, the Frame containing widgets added by the add method. bottom The subwidget reference to the bottom half of the DialogBox widget, the Frame containing the Button widgets. B_"button-text" Individual subwidget references to the Buttons in the DialogBox widget. The subwidget name is the string B_ concatenated with the Button's -text value. BUGS
There is no way of removing a widget once it has been added to the top Frame, unless you access the top subwidget and go through the child widgets. There is no control over the appearance of the Buttons in the bottom Frame nor is there any way to control the placement of the two Frames with respect to each other. AUTHOR
Rajappa Iyer rsi@earthling.net This code is distributed under the same terms as Perl. perl v5.12.1 2007-07-10 DialogBox(3)
All times are GMT -4. The time now is 01:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy