linux gurus

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hustlin Entertainment
    So Fucking Banned
    • May 2002
    • 2326

    #1

    linux gurus

    hey..i have a question for all you linux gurus out there..i have a small list of usernames and passwords..i want to extract the usernames only and put them into a seperate text file

    the file looks like this

    [email protected]:password
    [email protected]:password2

    i want to extract the #@test.com's,...how can i do this...im not new to linux just haven't used it in awhile

    thanks
  • Angry Jew Cat - Banned for Life
    (felis madjewicus)
    • Jul 2006
    • 20368

    #2
    write a quick perl script that'll extract all the emails. can't remember the name of the module that extracts emails of the top of my head. but if you search cpan you should find it easily enough. a little goolging should turn up smple code that'll perform the task. seems like a pretty common task to perform.

    try this

    perl -wne'while(/[\w\.]+@[\w\.]+/g){print "$&\n"}' test.txt
    Last edited by Angry Jew Cat - Banned for Life; 04-05-2009, 09:12 PM.

    Comment

    • Hustlin Entertainment
      So Fucking Banned
      • May 2002
      • 2326

      #3
      well i think i found something with grep, i don't think i even got perl installed on this box it'd be too much hassle, i'll post back with my results soon enough....

      Comment

      • Hustlin Entertainment
        So Fucking Banned
        • May 2002
        • 2326

        #4
        cut -d ':' -f 1 accounts.txt > accounts2.txt

        easiest way i've found....

        Comment

        • mikesouth
          Confirmed User
          • Jun 2003
          • 6334

          #5
          Originally posted by Hustlin Entertainment
          cut -d ':' -f 1 accounts.txt > accounts2.txt

          easiest way i've found....

          yup thats the right way to do it.
          Mike South

          It's No wonder I took up drugs and alcohol, it's the only way I could dumb myself down enough to cope with the morons in this biz.

          Comment

          • mikesouth
            Confirmed User
            • Jun 2003
            • 6334

            #6
            Originally posted by Hustlin Entertainment
            cut -d ':' -f 1 accounts.txt > accounts2.txt

            easiest way i've found....

            yup thats the right way to do it. cept you should probably use >> accounts2.txt lest you overwrite it every line dont remember how cut parses for that but >> would work either way long as ya dont run it more than once
            Mike South

            It's No wonder I took up drugs and alcohol, it's the only way I could dumb myself down enough to cope with the morons in this biz.

            Comment

            Working...