"bhaaluu" <[EMAIL PROTECTED]> wrote
> I'm also looking into 'sed' for doing this. I've used 'sed' in the
> past for
> deleting a specific line from files, as well as doing simple search
> and
> replace in a file. I just figured that if it can be done in 'sed,'
> it
> can be done in Python muc
Greetings,
Okay, I've had a chance to experiment with both solutions, and
both of them work as advertised. For those just tuning in, what
I wanted to do was delete a line in each file in a directory that
had a specific pattern in the line. There were over two hundred
files in the directory, and I
Sed is a little easier than python for this project, but python is more
flexible.
Sed would be
sed -e "s/^.*\
Greetings,
Many thanks to wormwood_3 and Kent for their help.
Summary:
The working script looks like this:
# the lines with '
bhaaluu wrote:
> On 9/13/07, wormwood_3 <[EMAIL PROTECTED]> wrote:
>
>> I think the problem is that the original script you borrowed looks
>> at
the file passed to input, and iterates over the lines in that file,
removing them if they match your pattern. What you actually want to be
doing is itera
On 9/13/07, wormwood_3 <[EMAIL PROTECTED]> wrote:
> I think the problem is that the original script you borrowed looks at the
> file passed to input, and iterates over the lines in that file, removing them
> if they match your pattern. What you actually want to be doing is iterating
> over the
Thought I would do some more testing and get you a more finalized form this
time.
So I took the mygrep.py script, and put it in a folder with 3 test files with
content like this:
I am some
lines of text
yep I love text
435345
345345345
Then I ran:
[EMAIL PROTECTED]:~/test$ python mygrep.py "
I think the problem is that the original script you borrowed looks at the file
passed to input, and iterates over the lines in that file, removing them if
they match your pattern. What you actually want to be doing is iterating over
the lines of your list file, and for each line (which represent
Greetings,
I'm running Python 2.4.3 on a GNU/Linux box.
This question is about using 'fileinput.'
I have a directory of files, and I've created a file list
of the files I want to work on:
$ ls > file.list
Each file in file.list needs to have a line removed,
leaving the rest of the file intact.