Programming :: Find And Replace Multiple Instances?

Aug 13, 2010

I have a file with the following in it:

:0 local /usr/X11R6/bin/X -nobanner
:1 local /usr/X11R6/bin/X

I need to add "-nolisten tcp" to both of these lines and cannot figure out how to do it. I can get it to do the first one, but not the 2nd and so on. How do I search the file and loop though it to change them all?

View 14 Replies


ADVERTISEMENT

General :: Replace Multiple Instances From X To Y In Line

Feb 1, 2010

I have a line of text with multiple web links in the line. I'd like to replace the actual links with the text "<web-link>" so I don't accidentally hit them while reading on my iphone. I've tried many versions of the following sed command, sed 's/(http.*)/<web_link>/g', but it simply replaces everything between the first instance of "(http" and the last instance of ")" with <web_link>, or does nothing at all.

Ex: This line has a link to a web page (http://www.webpage.com/file.html) then some more text (extra text) and then another link (http://www.nextwebpage.com.index.html) to a website.
$ echo "This line has a link to a web page (http://www.webpage.com/file.html) then some more text (extra text) and then another link (http://www.nextwebpage.com.index.html) to a website." | sed 's/(http.*)/<web_link>/g'

What I get is: This line has a link to a web page <web_link> to a website.
What I'd like is: This line has a link to a web page <web_link> then some more text (extra text) and then another link <web_link> to a website.
What am I doing wrong with my sed command?

View 4 Replies View Related

Programming :: Run Multiple Instances Of A Jar Executable?

May 5, 2009

It is possible to run multiple instances of a jar executable. Is it possible that only a single instance of the jar runs? Wrappers like JSmooth or Launch4J can be made to run as a single instance. But since there are no such wrappers for linux, I need a way to restrict the jar to a single instance. How to embed the jar file into an executable such it runs a single instance?

View 14 Replies View Related

Programming :: $1 Variable In Multiple Instances Of Same Script?

May 27, 2010

I am running a script that can run as many as 10 simultaneous times. During my testing, i noticed that if the script starts while another is in process, it inherits the $1 variable, which is always different.For example, the script starts with "scripthere.sh entry1", anther one starts almsot at the same time "scripthere.sh entry2". As the script is running, the second instance inherits $1 from the first script. So instead of $1 entry2, it shows up as entry1. how I can store $1 so that its unique to that instance of the script only?

View 2 Replies View Related

Programming :: Can Probe Monitor Multiple Instances Of Tomcat

Jan 31, 2011

I'm using Probe to monitor Tomcat5. The problem is that I've multiple instances of Tomcat.Can be used Probe to monitor multiples instances of Tomcat without having to deploy it to each instance?

View 2 Replies View Related

Server :: Find And Replace In Multiple Files In Ssh?

Jul 3, 2010

Find and replace in multiple files in ssh?

View 1 Replies View Related

General :: Find & Replace String In Multiple Files?

Jan 15, 2010

After hours (literally) of searching the web and reading man pages, I think I've come up with the following:Code:find . -exec grep 'path/to/file' -print | xargs -0 -I new_path mv {this is where I get confused}So my code above is incomplete, obviously. In order to finish replacing the string, I need to mv the new file into the old file's spot. How do I do this, by incorporating it into my line of code?

View 14 Replies View Related

Ubuntu :: Command Line - Find And Replace Text Within Multiple Files?

Aug 28, 2010

I'm pretty sure this is doable from the command line, but my CLI skills have degraded a lot since my pre-Y2K admin days. The goal is to search all the files in the directory for a very long string of text and replace it with another string of text. The text being searched for is my Google Adsense code (which will be stripped from my website) and it will be replaced with a placeholder so I can easily tack something else in there in the future.

Seeing how I have that long snip of code on about 100 pages, automating the process would make life easier.
If I was searching for a single word, I can see ways to do this.
If I paste the code I'm searching for into a text file, is there a way to:
find (contents of oldstring.txt) and replace with (contents of newstring.txt)?

View 9 Replies View Related

Programming :: Awk Multiple Line Search And Replace?

May 1, 2011

I am trying to search and replace a multi line pattern in a php file using awk.The pattern starts with

<div id="navbar">
and ends with
</div>

[code]...

View 3 Replies View Related

Programming :: Replace Html In Multiple Files (80+)

Mar 2, 2010

I want to change some HTML in my files (80+ so I prefer not to do this by hand). I got a script to replace a string in files, however the HTML I want to replace contains an enter (and tab of 4 spaces) (explanation below) Does someone know how I could update my HTML by using a function in Linux?

I also found sed but don't know how to use it with the enter (linenumbers will not work because they variate)...

[Code].....

View 2 Replies View Related

Programming :: Find And Replace Script In Bash?

Sep 28, 2010

Im looking for assistance to create a script to find and replace files.Probably best if I give you the background Our server uses a specific application which stores user data, each user data account (a folder on the server) has a file called 'Profile.xml' this file gets updated and replaced about every 30 mins similar to the fashion logrotate works i.e. Profile.xml.1 Profile.xml.2 -> .10

What we experience is that if the application crashes unexpectedly while it is doing its user profile refresh task we end up with sometimes a few hundred Profile.xml files which end up 0kb(should be around 4kb) , and our server see's these as corrupted profiles and will not see them. Our fix is to go back thru and rename the Profile.xml.1 to be Profile.xml (or sometimes up to Profile.xml.5 to Profile.xml) We want a script we can manually run to automate this process The server tree is

/mnt/array1/username/db/Profile.xml
/mnt/array2/username/db/Profile.xml
etc
etc

What we have so far is a script which finds the affected files

find /mnt/ -maxdepth 4 -name Profile.xml -size -1k

This will display a list of affected profiles, and we can append it to a text file with >>output.txt on the end.

if 'pattern' in 'location' equals '0kb' then 'cp' Profile.xml.1 Profile.xml

View 4 Replies View Related

Programming :: Exact Text Find And Replace?

Aug 13, 2010

I have a sysctl.conf that has the following in it:

kernel.exec-shield-randomize = 1
kernel.exec-shield = 1

When I grep kernel.exec-shield I get both line, hence I keep over writing the kernel.exec-shield-randomize in my script because it finds them both for my sed commend.

How can I get an exact match with either sed/awk/grep in shell so I can do a find and replace?

Example: sed 's/^kernel.exec-shield =.*/kernel.exec-shield = 1/g' /etc/sysctl.conf will replace BOTH lines

Example: grep "^kernel.exec-shield" find both line and I want it to find only the exact line.

View 3 Replies View Related

Programming :: Find And Replace With A Shell Script?

Mar 10, 2009

What is best way to replace the 1 and the 3 below with a 0 using a shell script? It is in a text file with lots of lines and similar lines:

lots of text
...
useHeloBlacklist:=1
DoIPinHelo:=3
...
lots of text

View 5 Replies View Related

Programming :: Find And Replace Using Passing A Parameter To Said Command?

Apr 9, 2010

I am trying following script can I do this or is there a way to do find and replace the replacing word is dynamic input by user

echo -n "Enter name:"
read RP_USER
sed 's/text1/$RP_USER/' /home/user/file1 > /home/user/file2

View 5 Replies View Related

Programming :: Multi-line Find - Replace With GnuWin32 Sed?

Apr 26, 2009

I would like to have a script that will do a search in an XML file for a specific block of XML code and replace it with a different block of XML code using the Windows build of GNU Sed 4.1.5.

Here's the text I want to find:

Code:

And here's what I want to replace it with:

Code:

There is however a lot of stuff in there that would mess up sed, and the one example from the sed FAQ (from the Sourceforge site) that looked promising and easy enough to figure out (4.23.3. Try to use a block of "literal strings") fails with this error message: sed: file blockrep.sed line 18: unterminated `s' command

Anyone got any ideas, or even an alternate program that can do this? (Preferably one that I can automate.)

View 4 Replies View Related

Programming :: Python - Find And Replace While Typing In Raw Input

Apr 30, 2010

I'm writing a program in Python that presents a place for the user to input one-line of text (using raw_input). I need, however, as the user types, for certain words to be replaced, even before the user hits enter.

I try to make an animation so you can see what I mean, here the word "pig" gets replaced with "sheep":
>I|
>I |
>I l|
>I li|
>I lik|
>I like|
>I like |
>I like t|
>I like to|
>I like to |
>I like to e|
>I like to ea|
>I like to eat|
>I like to eat |
>I like to eat p|
>I like to eat pi|
>I like to eat pig|
>I like to eat sheep|

Note, the user never typed "sheep", the program replaced "pig" with "sheep" as soon as they finished typing the word "pig". The user did not use "Enter". Is this at all possible in Python?

View 4 Replies View Related

Programming :: Find And Replace A String In A File Using Perl Command From Bash Script?

Feb 14, 2011

I wanted to find and replace a string from a perl file. I have written a script in bash which runs the following command.

perl -pi -e "s/$findstring/$replacestring/" testfile
where as $findstring = print F_WC_TMP"$line
";
and $replaceString = $line = join ' ', split ' ', $line; print F_WC_TMP"$line
";

But when I am running the above command, i think it is replacing the $findstring with the above mentioned string and hence it contains a $line, it is looking for the variable $line and not finding the exact string. I am confused about how to search for a string that contains $ in it and replace it with another $string.

View 5 Replies View Related

Fedora :: Run Multiple Instances Of Yum At The Same Time?

Jun 24, 2010

Is there any way to run multiple instances of yum at the same time. The need is to speed up the install process.

View 2 Replies View Related

Ubuntu :: Run Multiple Instances Of Ushare ?

Nov 22, 2010

I have multiple hard drives with videos on them and i can only get the my xbox to read the 1st in my list of directories. So i wanted to know can i run multiple instances of ushare and use one for each hard drive? Is it possible?

View 3 Replies View Related

Ubuntu :: Multiple Instances Of Terminal App?

Jun 25, 2011

How can I make it so that I can open multiple new instances of the terminal app by clicking on the corresponding icon? I'm running 11.04 with Gnome 3.

View 5 Replies View Related

Ubuntu :: Cannot Run Multiple Instances Of A Program

Jun 29, 2011

If I have a program running in one workspace and then switch to another workspace and open the same program it switches back to the first workspace.

View 5 Replies View Related

General :: Run Multiple Instances Of Same Program?

Feb 23, 2011

In windows xp, i created another user account. Now i can run a second instance of any program by right clicking on it and selecting Run as. Is such a thing possible in linux (centos or ubuntu) in graphical environment ?

View 4 Replies View Related

Debian :: Multiple Instances Of Mumble-server?

Oct 31, 2015

i'm new to linux, and i want to create mumble servers for my friends.My first server is finished and he works but, is it possible to create multiples instances of mumble ?

View 1 Replies View Related

Fedora Servers :: Multiple Instances Of Pulesaudio?

Sep 9, 2010

I've got two sound cards fitted, before I've always killed pulseaudio as a pain in the butt.

Without pulseaudio enabled I could run two audio apps simultaneously, ie run a SDR ( software defined radio) app , and listen to music or watch TV at the same time.

However, with puls audio running, you can only run one, either input to either output. So can a second instance of pulseaudio be run, master and slave perhaps ?

View 6 Replies View Related

General :: Start Multiple Instances Of Firefox?

Mar 31, 2010

How can I have multiple independent instances of Mozilla Firefox 3.5 on the same X server, but started from different user accounts (consequently, different profiles)?

Limited success was only with Xephyr :1, DISPLAY=:1 /usr/local/bin/firefox, but Xephyr has no Cygwin/X's "rootless" mode so it's not comfortable (see other question).

The idea is to have one Firefox instance for various "Serious Business" things and the other for regular browsing with dozens of add-ons securely isolated.

View 2 Replies View Related

General :: Why No Multiple Instances Of Firefox As On Windows

May 4, 2010

On Windows If I run Firefox as user jack, and then try to start another instance of firefox I will be unable to, as one is already running.If I choose to run firefox as administrator,then I can have two instances of firefox, separate from each other side by side, because they are under different user accounts.This does not seem to be true on Linux.As user jack if I start firefox, like on windows I am unable to start a new instance.If I open a terminal and change to root, set XAUTHORITY to jacks .Xauthority and try to start firefox as root....I get the error that firefox is already running.

View 1 Replies View Related

Ubuntu :: Disable Multiple Instances Of Evolution?

Feb 27, 2010

The great clock applet shows tasks and appointments from the evolution calendar. That's a great and fast overview of my agenda. But clicking a task of appointment opens a new instance from evolution every time, which is enormously annoying and really destroying productivity. I don't want 15 calendars open, I want the applet to behave like an index. So it should reuse the open instance and bring focus to the clicked appointment or task. How do I disable multiple instances of evolution?

View 2 Replies View Related

Ubuntu Servers :: Multiple Instances Of A Daemon?

May 27, 2010

I have a test server on which I'd like to run up to 30 separate instances of a program as daemons, each running on a different IP address bound to the server. I've created a init script that takes an additional command line parameter - the last octet of the IP address. For example:

Code:

sudo myprog 40 start
sudo myprog 41 start

This would run instances of the program on IP addresses 192.168.1.40 and 192.168.1.41 respectively. But it's looking like this approach isn't doable if I wish to have any or all of these run at startup, as the links in the rcN.d directories can only link to the init script, not pass a parameter.

View 2 Replies View Related

Ubuntu :: CPU 100% On Boot / Multiple Instances Of Same Process

Jul 30, 2010

I tried the google and browsing the known bugs in the sticky before posting this thread.On boot the machine is pegged at 100%. It is a dual-core with 4GB of ram and is running 10.04, 64bit. Also, as time goes on it eats up all the ram till theres maybe 32mb free. What happens is there are multiple 4-10+ identical processes running. seem to be gnome related.The machine sits idle on my floor and runs samba and apache/mysql/gallery for my test website that no on but myself visits.

View 5 Replies View Related

Ubuntu :: Enable Multiple Instances Of An Application

Oct 14, 2010

I have enabled netbook-launcher-efl and like the interface quite a lot, but it only allows me to launch a single instance of each application. I was told in an unrelated thread that there should be a setting in gconf-editor that enables multiple instances to be launched, but I thought it would be more appropriate if I broke that out into a separate thread.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved