Afficher un message
Vieux 27/08/2006, 01h05   #8
mik3
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: newbie question: remove lines from text-file


Martin Jørgensen wrote:
> Hi,
>
> I have a +200 kb log file from which I want to remove lines such as this
> one:
>
> 5950K ......... ......... ......... ......... ......... ......... 59%
> 5600K ......... ......... ......... ......... ......... ......... 60%
> 5650K ......... ......... ......... ......... ......... ......... 61%
>
> It's called wget-log. I'm not really good at linux bash shells so how do
> I remove those lines with "......... ......... ......... ........." ?
>
> I suppose I could do something like "cat wget-log |
> (some-command/grep?) > newfile" but there are probably better methods,
> including not creating a new file...
>
>
> Best regards
> Martin Jørgensen
>
> --
> ---------------------------------------------------------------------------
> Home of Martin Jørgensen - http://www.martinjoergensen.dk



if you know Python,

o = open("newfile","a")
for lines in open("wget-log"):
if not "......... ......... ......... ........." in lines:
o.write(lines)
o.close()

  Réponse avec citation
 
Page generated in 0,04675 seconds with 9 queries