Re: Sed or awk: remove a line from a file

2010-06-07 Thread Dotan Cohen
On 3 June 2010 03:33, Karl Vogel wrote: > > Here are some good pages on sed and awk one-liners: > >  http://www.catonmat.net/blog/sed-one-liners-explained-part-one/ >  Famous Sed One-Liners Explained, Part I: File Spacing, Numbering and >    Text Conversion and Substitution >  Wed, 8 Oct 2008 03:0

Re: Sed or awk: remove a line from a file

2010-06-03 Thread Karl Vogel
Here are some good pages on sed and awk one-liners: http://www.catonmat.net/blog/sed-one-liners-explained-part-one/ Famous Sed One-Liners Explained, Part I: File Spacing, Numbering and Text Conversion and Substitution Wed, 8 Oct 2008 03:00:00 -0400 http://www.catonmat.net/blog/sed-on

Re: Sed or awk: remove a line from a file

2010-06-02 Thread James Brown
Andrei Popescu wrote: > On Fri,28.May.10, 15:19:21, Dotan Cohen wrote: > > >> sed or awk. But I've been reading sed and awk tutorials for two hours >> and I cannot figure out how to remove line N from the file without >> creating a second file. If I'm already going through the hassle of >> creat

Re: Sed or awk: remove a line from a file

2010-05-28 Thread John A. Sullivan III
On Fri, 2010-05-28 at 17:38 +0200, Elimar Riesebieter wrote: > * John A. Sullivan III [100528 11:06 -0400] > > On Fri, 2010-05-28 at 15:52 +0200, Elimar Riesebieter wrote: > > > * John A. Sullivan III [100528 09:19 -0400] > > > > On Fri, 2010-05-28 at 14:45 +0200, François TOURDE wrote: > > > [...]

Re: Sed or awk: remove a line from a file

2010-05-28 Thread Elimar Riesebieter
* John A. Sullivan III [100528 11:06 -0400] > On Fri, 2010-05-28 at 15:52 +0200, Elimar Riesebieter wrote: > > * John A. Sullivan III [100528 09:19 -0400] > > > On Fri, 2010-05-28 at 14:45 +0200, François TOURDE wrote: > > [...] > > > > > > > > Don't use sed nor awk... > > > > > > > > man ssh-key

Re: Sed or awk: remove a line from a file

2010-05-28 Thread John A. Sullivan III
On Fri, 2010-05-28 at 15:52 +0200, Elimar Riesebieter wrote: > * John A. Sullivan III [100528 09:19 -0400] > > On Fri, 2010-05-28 at 14:45 +0200, François TOURDE wrote: > [...] > > > > > > Don't use sed nor awk... > > > > > > man ssh-keygen say: > > > > > > -R hostname > > > Re

Re: Sed or awk: remove a line from a file

2010-05-28 Thread Elimar Riesebieter
* John A. Sullivan III [100528 09:19 -0400] > On Fri, 2010-05-28 at 14:45 +0200, François TOURDE wrote: [...] > > > > Don't use sed nor awk... > > > > man ssh-keygen say: > > > > -R hostname > > Removes all keys belonging to hostname from a known_hosts > > file. This option i

Re: Sed or awk: remove a line from a file

2010-05-28 Thread John A. Sullivan III
On Fri, 2010-05-28 at 09:19 -0400, John A. Sullivan III wrote: > On Fri, 2010-05-28 at 14:45 +0200, François TOURDE wrote: > > Le 14757ième jour après Epoch, > > Dotan Cohen écrivait: > > > > > As I regularly format my test box, I often get stuck SSHing into it, like > > > this: > > > > > > $ ssh

Re: Sed or awk: remove a line from a file

2010-05-28 Thread John A. Sullivan III
On Fri, 2010-05-28 at 14:45 +0200, François TOURDE wrote: > Le 14757ième jour après Epoch, > Dotan Cohen écrivait: > > > As I regularly format my test box, I often get stuck SSHing into it, like > > this: > > > > $ ssh u...@domain > > @@@ >

Re: Sed or awk: remove a line from a file

2010-05-28 Thread Erwan David
On Fri, May 28, 2010 at 02:19:21PM CEST, Dotan Cohen said: > As I regularly format my test box, I often get stuck SSHing into it, like > this: > > $ ssh u...@domain > @@@ > @WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ >

Re: Sed or awk: remove a line from a file

2010-05-28 Thread Dotan Cohen
On 28 May 2010 15:45, François TOURDE wrote: > Don't use sed nor awk... > > man ssh-keygen say: > >     -R hostname >             Removes all keys belonging to hostname from a known_hosts file.   > This option is useful to delete hashed >             hosts (see the -H option above). > Thanks, I w

Re: Sed or awk: remove a line from a file

2010-05-28 Thread François TOURDE
Le 14757ième jour après Epoch, Dotan Cohen écrivait: > As I regularly format my test box, I often get stuck SSHing into it, like > this: > > $ ssh u...@domain > @@@ > @WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ >

Re: Sed or awk: remove a line from a file

2010-05-28 Thread Dotan Cohen
On 28 May 2010 15:38, Tixy wrote: > The -i option edits files in place, so... > >    sed -i 44d ~/.ssh/known_hosts > Thanks, I was simply missing the -i option. My weekend starts in less than one hour, must be related. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- To UNSU

Re: Sed or awk: remove a line from a file

2010-05-28 Thread Tixy
On Fri, 2010-05-28 at 15:19 +0300, Dotan Cohen wrote: > I'd like to just remove line 44 from > ~/.ssh/known_hosts. Easy to do in VIM, probably even easier to do in > sed or awk. The -i option edits files in place, so... sed -i 44d ~/.ssh/known_hosts -- Tixy () The ASCII R

Re: Sed or awk: remove a line from a file

2010-05-28 Thread Dotan Cohen
On 28 May 2010 15:27, Andrei Popescu wrote: > On Fri,28.May.10, 15:19:21, Dotan Cohen wrote: > >> sed or awk. But I've been reading sed and awk tutorials for two hours >> and I cannot figure out how to remove line N from the file without >> creating a second file. If I'm already going through the

Re: Sed or awk: remove a line from a file

2010-05-28 Thread Andrei Popescu
On Fri,28.May.10, 15:19:21, Dotan Cohen wrote: > sed or awk. But I've been reading sed and awk tutorials for two hours > and I cannot figure out how to remove line N from the file without > creating a second file. If I'm already going through the hassle of > creating then moving a second file then

Sed or awk: remove a line from a file

2010-05-28 Thread Dotan Cohen
As I regularly format my test box, I often get stuck SSHing into it, like this: $ ssh u...@domain @@@ @WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@ IT IS POSSIBLE THAT