Simple Question 
Author Message
 Simple Question

Hi.

I have a file full of names and email addresses for a mailing list that
I'm administering.
the format is


How can I isolate just the username.

I would really appreciate if someone could help me with this.

sincerely,

Ovanes



Fri, 18 Feb 2000 03:00:00 GMT  
 Simple Question



Quote:
>I have a file full of names and email addresses for a mailing list that
>I'm administering.
>the format is


>How can I isolate just the username.

 username= substr($0,index($0, "<")+1)

would probably work and uses (too) many awk constructs for your education ;-)

Rgds
Mark
--
Mark Katz
ISPC, London - Innovation in data-delivery tools
Tel: (44) 181-455 4665, Fax (44) 181-458 9554
** Visit our website on http://www.efiche.com/efiche **



Sat, 19 Feb 2000 03:00:00 GMT  
 Simple Question

Hello!

Quote:

> the format is


> How can I isolate just the username.

How about:


Caution: This is untested and may require careful quoting depending
on your OS, shell, sed, etc.

-----------------------------------------------------------------------------

program can send to the terminal but not get                    Clemens Meier
at itself, your customers start to say very    GO C++ 3$ UL L+>+++ E++>+++ P-
unkindly things about you.       R.A.O'Keefe   N++ R+>+++ G'''' b++ TWERPS+++



Sat, 19 Feb 2000 03:00:00 GMT  
 Simple Question




% >I have a file full of names and email addresses for a mailing list that
% >I'm administering.
% >the format is
% >

% >How can I isolate just the username.
%
%  username= substr($0,index($0, "<")+1)

%
% would probably work and uses (too) many awk constructs for your education ;-)

If that's all that you have in the file, you could just set the field
separator:

 { isolated[i++] = $2 }

--

Patrick TJ McPhee
East York  Canada



Sun, 20 Feb 2000 03:00:00 GMT  
 Simple Question

Quote:


> >the format is


> >How can I isolate just the username.

> of experience forces me to ask: Are you sure that that's the only
> format in the file? As I understand it, there are at least two more
> allowed.



> The latter should be no problem, but the first is going to break any
> pattern relying on the presence of the angle brackets.

How about:


        print substr( $0, RSTART, RLENGTH )

        print substr( $0, RSTART, RLENGTH )

I'd combine the two patterns into one with an "|" operator, but I'm not
certain which one would take precedence, and I want the shortest
possible match.

Anton



Mon, 21 Feb 2000 03:00:00 GMT  
 Simple Question

Ovanes,

I'm assuming that your OS is some flavor of UNIX:-


This should isolate the username for you.

Naresh.

Quote:

> Hi.

> I have a file full of names and email addresses for a mailing list that
> I'm administering.
> the format is


> How can I isolate just the username.

> I would really appreciate if someone could help me with this.

> sincerely,

> Ovanes



Tue, 22 Feb 2000 03:00:00 GMT  
 Simple Question

Quote:


> >I have a file full of names and email addresses for a mailing list that
> >I'm administering.
> >the format is


> >How can I isolate just the username.

> Good question that provoked some very useful responses, but the voice
> of experience forces me to ask: Are you sure that that's the only
> format in the file? As I understand it, there are at least two more
> allowed.



> The latter should be no problem, but the first is going to break any
> pattern relying on the presence of the angle brackets.

> --
>     |\^/|     Maynard Hogg

Fortunately,

that is the only format.

I received many responses and different ways to solve the problem.
I'd just like to say thanks for all the help.

I got to reading some more about regular expressions and came up with a
way of doing it that I hadn't seen in any of responses, but that worked
too.


As far as I could tell, this worked the same way the other ones did.

Well, Thanks again.

Sincerely,

Ovanes M.



Tue, 22 Feb 2000 03:00:00 GMT  
 Simple Question

        sed   is   flexible enuf to care for diff formats.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            my !  my!  my !
        that is the kind of problems seders help each other with.
                     join seders now !  email moi !

    for a 1stop sed needs, join seders, the informal sed mailing list.      
    sed is literate.  sed knows 4 R's: read, 'rite, 'rithmetic, recur.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                        sed informal mailing list

    Of abpit half a dozen sed studs known to sedkind, seders has 3, in
                     usa     portugal   taiwan

                               -----

                   sed web pages (in 5 countries)

http://www.wollery.demon.co.uk   seders grab bag (seders official web page)
                                                              seder  Casper
http://www.cis.nctu.edu.tw/~gis84806/sed-script-e.html      seder in taiwan
http://www.math.fu-berlin.de/~guckes/sed/          seder, Herr Guckes
http://www.math.fu-berlin.de/~leitner/sed/          seder, Herr von Leitner
http://www.dbnet.ece.ntua.gr/~george/#seders  seder, engineer, Dr2b Yiorgos
ftp://olivia.inesc.pt/pub/users/cdua/scripts/sed         the great sed stud
ftp://olivia.inesc.pt/pub/users/cdua/scripts/sh   seder Carlos J. G. Duarte

                                ----

             my favourite DOS/UNIX sed15 (with C source)
(easily compilable for UNIX.  has friendly extenstions/relaxations like hex)
 ftp://uiarchive.uiuc.edu/pub/systems/pc/simtelnet/msdos/txtutl/sed15.zip
 ftp://uiarchive.uiuc.edu/pub/systems/pc/simtelnet/msdos/txtutl/sed15x...

Directory: /pub/systems/pc/simtelnet/msdos/txtutl/
Filename    Type Length  Date    Description
===============================================================================
sed15.zip    B    62082  910930  Unix-compatible streaming editor v1.5 TC src
sed15x.zip   B    20300  910930  Unix-compatible streaming editor v1.5 EXE/docs

              sed15.zip has C source, compilable for UNIX.

             Also, check simtel for u-sedit. has nice docs.

gnused for dos:  http://www.simtel.net/pub/simtelnet/win95/prog/gsed205b.zip
                                ----

                O'Reilly sed books http://www.ora.com
1- sed and awk 2nd edition         by   Dale Dougherty  +  Arnold Robbins
        (mostly for awk)
2- mastering regular expressions   by          Jeffrey E. F. Friedl
        (mostly for perl, emacs, awk.  but touches on sed)

                                ----
                   newsgroup alt.comp.editors.batch      
      though seders news group, alt.comp.editors.batch deals with
batch, AI, data warehousing, OLAP, computer security, filters, linguistics,
      awk, perl, unix, computer seminars, CFP, etc (even sed)

           started by a seder, PhD2b, engineer, the hawk
                         Yiorgos Adamopoulos.    

          most newsfeeds do not carry alt.comp.editors.batch
          but everyone can get it via  dejanews (and others)
  you can even follow up, reply to the poster, etc.  dejanews is great.
             (then he sed: not by sed alone ... lives man)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


: >I have a file full of names and email addresses for a mailing list that
: >I'm administering.
: >the format is


: >How can I isolate just the username.

: Good question that provoked some very useful responses, but the voice
: of experience forces me to ask: Are you sure that that's the only
: format in the file? As I understand it, there are at least two more
: allowed.



: The latter should be no problem, but the first is going to break any
: pattern relying on the presence of the angle brackets.

: --
:     |\^/|     Maynard Hogg
:  _|\|   |/|_  #306, 4-30-10 Yoga, Setagaya-ku, Tokyo, Japan 158
:  >         <  Fax: +81-3-3700-7399

:               http://www2.gol.com/users/maynard/
: Unsolicited commercial electronic mail sent to this address will be
: copyedited at a cost of US$200/hour (half-hour minimum).
--
=-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
al aab, seders moderator                                      sed u soon
               it is not zat we do not see the  s o l u t i o n          
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+



Thu, 24 Feb 2000 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Question in french (a simple question, very simple)

2. Simple Question seeks simple answer

3. Stumper Question for me: simple question for this group -exponential and logs

4. HTML simple question ?

5. J (simple) questions

6. simple question

7. simple question

8. Concatenating strings..simple question.

9. What is APL\11 (A Simple Question)

10. A simple question.

11. A Simple Question

12. Fw: What is APL\11 (A Simple Question)

 

 
Powered by phpBB® Forum Software