Try
then check the list. If you like it:
If you hit permission errors then you need to rethink what you are doing because you may have selected system files you should not have changed earlier.
You can run the file loop statement over and over until you are error free. Why? Because will not change anything in files it already fixed.
Check back here if you need help.
Edit:
Rudi beat me to an answer. I still think a little caution is good idea as well.
This User Gave Thanks to jim mcnamara For This Post:
I used the following script
cd pathname
for y in `ls *`;
do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y;
done
and it worked fine for finding and replacing strings with names etc. in all files of the given path.
I'm trying to replace a string which consists of path (location of file)
... (2 Replies)
Hi,
I have a directory has DIR1 and the D1 directory has 200+ files.
I want change the string from "Bangalore" to "Bangaluru" in all files in the D1 directory.
Thanks (2 Replies)
I used the following script
cd pathname
for y in `ls *`;
do sed "s/ABCD/DCBA/g" $y > temp; mv temp $y;
done
and it worked fine for finding and replacing strings with names etc. in all files of the given path.
I'm trying to replace a string which consists of path (location of file)
... (11 Replies)
Hi ,
I have a directory structure as dir and subdirectories and files under it and so on.now I need to find the files which contain the search string under every dir and subdir and replace .
my search string is like
searchstring=/a/b
string to be replaced=/a/c/b
please help.
... (7 Replies)
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)
I have 100+ python files in a single directory. I need to replace a specific path occurrence with a variable name.
Following are the find and the replace strings:
Findstring--"projects\\Debugger\\debugger_dp8051_01\\debugger_dp8051_01.cywrk"
Replacestring--self.projpath
I tried... (5 Replies)
Hi,
I have a very large file that contains a listing of all files on the system. I need to create a listing from that file of all files that start with the following format: s???_*, whereas the '?' represents characters, so the file name begins with an 's' followed by three other characters and... (4 Replies)
I have tried just about every find and grep command possible and I cannot find these damn files!!
This is the problem:
On the node you just swapped in, there are 5 JPEG files whose names contain the word "intro" in some form. Find all five files from on the entire disk (i.e. from root /).
... (2 Replies)
Hii,
Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories.
Eg.
file1: test1.log
file2: test2.log
file3 test.zip
After running the script
file1: string_test1.log
file2: string_test2.log
file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies
LEARN ABOUT DEBIAN
withlist
withlist(8) System Manager's Manual withlist(8)NAME
withlist - General framework for interacting with a Mailman mailing list object.
SYNOPSIS
withlist [options] listname [args ...]
There are two ways to use this script: interactively or programmatically. Using it interactively allows you to play with, examine and mod-
ify a MailList object from Python's interactive interpreter. When running interactively, a MailList object called `m' will be available in
the global namespace. It also loads the class MailList into the global namespace.
Programmatically, you can write a function to operate on a MailList object, and this script will take care of the housekeeping (see below
for examples). In that case, the general usage syntax is:
OPTIONS -l, --lock
Lock the list when opening. Normally the list is opened unlocked (e.g. for read-only operations). You can always lock the file
after the fact by typing `m.Lock()'
Note that if you use this option, you should explicitly call m.Save() before exiting, since the interpreter's clean up procedure
will not automatically save changes to the MailList object (but it will unlock the list).
-i, --interactive
Leaves you at an interactive prompt after all other processing is complete. This is the default unless the -r option is given.
-r [module.]callable, --run [module.]callable
This can be used to run a script with the opened MailList object. This works by attempting to import module (which must already be
accessible on your sys.path), and then calling callable from the module. callable can be a class or function; it is called with the
MailList object as the first argument. If additional args are given on the command line, they are passed as subsequent positional
args to the callable.
Note that module. is optional; if it is omitted then a module with the name callable will be imported.
The global variable `r' will be set to the results of this call.
-a, --all
This option only works with the -r option. Use this if you want to execute the script on all mailing lists. When you use -a you
should not include a listname argument on the command line. The variable `r' will be a list of all the results.
-q, --quiet
Suppress all status messages.
-h, --help
Print a small help text and exit.
EXAMPLES
Here's an example of how to use the -r option. Say you have a file in the Mailman installation directory called `listaddr.py', with the
following two functions:
def listaddr(mlist):
print mlist.GetListEmail()
def requestaddr(mlist):
print mlist.GetRequestEmail()
Now, from the command line you can print the list's posting address by running the following from the command line:
% bin/withlist -r listaddr mylist
Loading list: mylist (unlocked)
Importing listaddr ...
Running listaddr.listaddr() ...
mylist@example.com
And you can print the list's request address by running:
% bin/withlist -r listaddr.requestaddr mylist
Loading list: mylist (unlocked)
Importing listaddr ...
Running listaddr.requestaddr() ...
mylist-request@example.com
As another example, say you wanted to change the password for a particular user on a particular list. You could put the following function
in a file called `changepw.py':
from Mailman.Errors import NotAMemberError
def changepw(mlist, addr, newpasswd):
try:
mlist.setMemberPassword(addr, newpasswd)
mlist.Save()
except NotAMemberError:
print 'No address matched:', addr
and run this from the command line:
% bin/withlist -l -r changepw mylist somebody@example.org foobar
AUTHOR
Author of Mailman is the Mailman Cabal, see http://www.list.org/ for information. This manpage is written for Debian by Bernd S. Brentrup
<bsb@debian.org>, but may be used by others.
SEE ALSO
Mailman documentation on http://www.list.org/ and in /usr/share/doc/mailman.
2007-07-14 withlist(8)