Sponsored Content
Top Forums Shell Programming and Scripting find & replace with user input Post 302358822 by mike909 on Monday 5th of October 2009 01:13:48 AM
Old 10-05-2009
find & replace with user input

Trying to create a script/executable to replace "abc" text string in "myfile.htm" with input from a pop-up field. For example, launch this thing and a prompt is popped up asking the user to input what "abc" should be replaced with, then it inserts what the user inputs in place of abc in the myfile.htm.
"abc" will always be there...ie the string being replaced is static. Eventually, it will then ftp myfile.htm to a server, but I'll tackle that next (one thing at a time). This will ultimately be getting run from a windows xp box, but I figured it would be easier to figure out how to do this in bash (hopefully awk?), and try to make it work on xp from there.

myfile.htm:
Quote:
abc
xyz
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find & Replace

I get a text file with 70+ columns (seperated by Tab) and about 10000 rows. The 58th Column is all numbers. But sometimes 58th columns has "/xxx=##" after the numeric data. I want to truncate this string using the script. Any Ideas...:confused: (3 Replies)
Discussion started by: gagansharma
3 Replies

2. Shell Programming and Scripting

replace <Address> with a var input by user

Hi, All here is not a full version script, just post a sample. #/bin/bash read -p 'Addr: ' addr sed 's/<Address>/'"$addr"'/' pf.mod>$1 If the input string include `/', sed will return error message. I know that s/// can be replaced with s::: or s!!!, etc, but the input var can accept... (4 Replies)
Discussion started by: r2007
4 Replies

3. Shell Programming and Scripting

Find & Replace string in multiple files & folders using perl

find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g' this is simple logic to find and replace in multiple files & folders Hope this helps. Thanks Zaheer (0 Replies)
Discussion started by: Zaheer.mic
0 Replies

4. Homework & Coursework Questions

[Scripting]Find & replace using user input then replacing text after

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: (o) Checkout an auto part: should prompt the user for the name of the auto part and borrower's name: Name:... (2 Replies)
Discussion started by: SlapnutsGT
2 Replies

5. Shell Programming and Scripting

Search & Replace in Multiple Files by reading a input file

Hi, I have a folder which contains multiple config.xml files and one input file, Please see the below format. Config Files format looks like :- Code: <application name="SAMPLE-ARCHIVE"> <NVPairs name="Global Variables"> <NameValuePair> ... (0 Replies)
Discussion started by: haiksuresh
0 Replies

6. Shell Programming and Scripting

find and replace in a directory using an input file

Hi folks, I need help to finish this script please. see below: I have an input file with all the IP address to names formated like so in a txt file addnsr1pri 166.7.3.105 addnsr1sec 166.2.100.22 addnsr2pri 166.2.220.121 addnsr2sec 166.3.68.45... (12 Replies)
Discussion started by: richsark
12 Replies

7. Shell Programming and Scripting

awk + gsub to search multiple input values & replace with located string + extra text

Hi all. I have the following command that is successfully searching for any one of the strings on all lines of a file and replacing it with the instructed value. cat inputFile | awk '{gsub(/aaa|bbb|ccc|ddd/,"1234")}1' > outputFile This does in fact replace any occurrence of aaa, bbb,... (2 Replies)
Discussion started by: dazhoop
2 Replies

8. UNIX for Dummies Questions & Answers

Find & Replace

Hi I am looking to rename the contents of this dir, each one with a new timestamp, interval of a second for each so it the existing format is on lhs and what I want is to rename each of these to what is on rhs..hopefully it nake sense CDR.20060505.150006.gb CDR.20121211.191500.gb... (3 Replies)
Discussion started by: rob171171
3 Replies

9. Shell Programming and Scripting

How-To Check & Filter user input

Hi, On my Java webpage which invokes the shell script has two checkboxes viz ... apache and weblogic apache require one parameter i.e apache home from the user while Weblogic requires three or five params from the user vi.z weblogic_home or <jdk_home, config_home & pid>, username and... (4 Replies)
Discussion started by: mohtashims
4 Replies

10. Shell Programming and Scripting

Search & Replace in Multiple Files by reading a input file

I have a environment property file which contains: Input file: value1 = url1 value2 = url2 value3 = url3 and so on. I need to search all *.xml files under directory for value1 and replace it with url1. Same thing I have to do for all values mentioned in input file. I need script in unix bash... (7 Replies)
Discussion started by: Shamkamde
7 Replies
XtPopupSpringLoaded()													     XtPopupSpringLoaded()

Name
  XtPopupSpringLoaded - map a spring-loaded popup from within an application.

Synopsis
  void XtPopupSpringLoaded(popup_shell)
	   Widget popup_shell;

Inputs
  popup_shell
	    Specifies the shell widget to be popped up.

Availability
  Release 4 and later.

Description
  XtPopupSpringLoaded() 	calls	      the	  functions	    registered	       on	  the	     specified	      shell's
  XtNpopupCallback callback list and pops the shell up, making it a spring-loaded shell.  A spring-loaded shell is one that is popped  up  in
  response to a button press and will pop down when the button is released.  Spring-loaded shells have events dispatched to them specially to
  ensure that they receive the button up event, even if it occurs in another window.  See XtAddGrab() for more details.

  XtPopupSpringLoaded() performs exactly like XtPopup(), except that XtPopupSpringLoaded() does the following:

  o  Sets the shell spring_loaded field to True.

  o  Always calls XtAddGrab() with exclusive set to True and spring_loaded set to True.

  See XtPopup() for details.

Usage
  You can also pop up spring loaded shells by using the XtMenuPopup action in a translation table.  This  predefined  action  calls  XtPopup-
  SpringLoaded().

  Any pop up shell can be popped down with XtPopdown(), the XtCallbackPopdown() callback function, or with the XtMenuPopdown action.

  XtPopupSpringLoaded()  was  added  in  Release  4,  and  prior to this release, the only way to pop up a spring loaded shell was to use the
  MenuPopup action (which has now been renamed XtMenuPopup).

See Also
  XtAddGrab(1), XtCreatePopupShell(1), XtMenuPopdown(1), XtMenuPopup(1), XtPopdown(1), XtPopup(1).

Xt - Pop Ups														     XtPopupSpringLoaded()
All times are GMT -4. The time now is 04:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy