[nflug] You qualify as a Dinosaur if ...
David J. Andruczyk
djandruczyk at yahoo.com
Mon Apr 16 09:06:26 EDT 2007
Instead of that vi line, I'd just have used:
cat file | cut -f 2- -d" " > newfile
--- Ken Smith <kensmith at cse.Buffalo.EDU> wrote:
> On Sun, 2007-04-15 at 22:36 -0700, Robert Meyer
> wrote:
> > ... the following: :1,$s/^\([0-9]*\)\( \)/\2\1/
> Now a *real*
> > dinosaur can explain just exactly what that did.
>
> Hmm, sounds like a challenge to me... :-)
>
> If a line begins with a number (any number of
> digits) followed by a
> space "tag" the number as the-first-thing-tagged and
> the space as
> the-second-thing-tagged. Substitute for that whole
> pattern
> the-second-thing-tagged (space) followed by
> the-first-thing-tagged
> (number) on lines numbered 1 through
> however-many-lines-are-in-file.
>
> I don't usually demo tagging in vi(1) for the
> sys-admin class (I usually
> use grep(1) for that) but I do demo line editing by
> asking them how long
> it would take them to take a copy of /etc/passwd and
> then edit it so
> that it only contained the usernames one per line in
> <insert-your-favorite-PC-editor>. Then I show them
> what vi(1) does when
> you type in:
>
> :1,$ s/:.*//
>
> while editing a copy of the passwd file. :-)
>
> --
> Ken
> Smith
> - From there to here, from here to |
> kensmith at cse.buffalo.edu
> there, funny things are everywhere. |
> - Theodore Geisel |
>
>
> _______________________________________________
> nflug mailing list
> nflug at nflug.org
> http://www.nflug.org/mailman/listinfo/nflug
>
-- David J. Andruczyk
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
nflug mailing list
nflug at nflug.org
http://www.nflug.org/mailman/listinfo/nflug
More information about the nflug
mailing list