On Jan 7, 1:21 am, Francesco Pietra <[EMAIL PROTECTED]> wrote:
> Please, how to adapt the following script (to delete blank lines) to delete
> lines containing a specific word, or words?
>
> f=open("output.pdb", "r")
> for line in f:
>
Francesco Pietra wrote:
>
> Please, how to adapt the following script (to delete blank lines) to
> delete
> lines containing a specific word, or words?
>
> f=open("output.pdb", "r")
> for line in f:
> line=line.rstrip()
> if line:
As I said I am no expert in OS and commands, except on what concerns mechanical
statistical and quantum mechanical calculations. Therefore, better for me (and
for all guys here) if I stop on this matter. My reply is only to say that I did
the job with:
f=open("prod1-3_no_wat_pop.pdb", "r")
for lin
; >
> >> On Sun, 06 Jan 2008 09:21:33 -0800, Francesco Pietra wrote:
> >>
> >> > Please, how to adapt the following script (to delete blank lines) to
> >> > delete lines containing a specific word, or words?
> >>
> >> That's tricky,
On Mon, 07 Jan 2008 00:42:01 +, Grant Edwards wrote:
>> If you want to delete them, you still have to do the rest of the job
>> yourself.
>
> Nonsense.
>
> How is this not doing what the OP asks?
>
>grep -v pattern infile >outfile; mv outfile infile
It isn't deleting lines. As abstract
On Mon, 07 Jan 2008 00:33:36 +0100, Bjoern Schliessmann wrote:
> Steven D'Aprano wrote:
>
>> grep doesn't delete lines. grep matches lines. If you want to delete
>> them, you still have to do the rest of the job yourself.
>
> In which way does "grep -v mypattern myfile > myfile" not delete the
>
gt;>
>>> On Sun, 06 Jan 2008 09:21:33 -0800, Francesco Pietra wrote:
>>>
>>> > Please, how to adapt the following script (to delete blank lines) to
>>> > delete lines containing a specific word, or words?
>>>
>>> That's tricky,
On Jan 6, 3:33 pm, Bjoern Schliessmann wrote:
> Steven D'Aprano wrote:
> > grep doesn't delete lines. grep matches lines. If you want to
> > delete them, you still have to do the rest of the job yourself.
>
> In which way does "grep -v mypattern myfile > myfile" not delete the
> lines matching myp
Steven D'Aprano wrote:
> grep doesn't delete lines. grep matches lines. If you want to
> delete them, you still have to do the rest of the job yourself.
In which way does "grep -v mypattern myfile > myfile" not delete the
lines matching mypattern?
Regards,
Björn
--
BOFH excuse #184:
loop fo
; Please, how to adapt the following script (to delete blank lines) to
>> > delete lines containing a specific word, or words?
>>
>> That's tricky, because deleting lines from a file isn't a simple
>> operation. No operating system I know of (Windows, Linux,
On Sunday 06 January 2008 21:25 Francesco Pietra wrote:
>> yes lines starting with a "#" are comments in python but that shouldn't
>> be of concern for your input data. I don't quite get what you want
>> here...
>
> Leaving the lines commented out would permit to resume them or at least
> remeber
Steven:
Thanks. See below please (of very marginal interest)
--- Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> On Sun, 06 Jan 2008 09:21:33 -0800, Francesco Pietra wrote:
>
> > Please, how to adapt the following script (to delete blank lines) to
> > delete lines c
On Sun, 06 Jan 2008 09:21:33 -0800, Francesco Pietra wrote:
> Please, how to adapt the following script (to delete blank lines) to
> delete lines containing a specific word, or words?
That's tricky, because deleting lines from a file isn't a simple
operation. No operating
--- Martin Marcher <[EMAIL PROTECTED]> wrote:
> On Sunday 06 January 2008 18:21 Francesco Pietra wrote:
>
> > Please, how to adapt the following script (to delete blank lines) to
> > delete lines containing a specific word, or words?
> >
> > f=open(
On Sunday 06 January 2008 18:21 Francesco Pietra wrote:
> Please, how to adapt the following script (to delete blank lines) to
> delete lines containing a specific word, or words?
>
> f=open("output.pdb", "r")
> for line in f:
> line=line.rstrip()
> if l
On 2008-01-06, Matt Nordhoff <[EMAIL PROTECTED]> wrote:
>> Please, how to adapt the following script (to delete blank lines) to delete
>> lines containing a specific word, or words?
> If you're on Linux, why not just use grep?
>
> $ grep -v theword output.pdb
A
)
> From: Francesco Pietra <[EMAIL PROTECTED]>
> Subject: Delete lines containing a specific word
> To: python-list@python.org
>
> Please, how to adapt the following script (to delete blank lines) to delete
> lines containing a specific word, or words?
>
> f=open("out
Francesco Pietra wrote:
> Please, how to adapt the following script (to delete blank lines) to delete
> lines containing a specific word, or words?
>
> f=open("output.pdb", "r")
> for line in f:
> line=line.rstrip()
> if line:
>
Please, how to adapt the following script (to delete blank lines) to delete
lines containing a specific word, or words?
f=open("output.pdb", "r")
for line in f:
line=line.rstrip()
if line:
print line
f.close()
If python in Linux accepts lines
19 matches
Mail list logo