LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-03-2011, 12:51 PM   #1
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
Email account file (need help sorting it out)


I have a text file called active.txt from our Linux server.

The format is as follows:

aabonner@xanco.com,0,
aagiang@xanco.com,2,
aalfaro@xanco.com,2,
aandirene@xanco.com,0,

The '0' by the email address means an active account the '2' means inactive email account.

How can I sort this file and just leave the active accounts with a '0' but have it formatted like this:

aabonner@xanco.com
aandirene@xanco.com

I do not need the (,0,) on the end since I am putting this in a database for the email server to query.

Any help would be great.

thanks
 
Old 05-03-2011, 02:00 PM   #2
winning
Member
 
Registered: Apr 2011
Posts: 70

Rep: Reputation: 13
Something like..
Code:
grep ',0,' ADDRESSES | cut -d',' -f1
perhaps?
 
Old 05-03-2011, 03:20 PM   #3
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Original Poster
Rep: Reputation: 23
Smile

Quote:
Originally Posted by winning View Post
Something like..
Code:
grep ',0,' ADDRESSES | cut -d',' -f1
perhaps?
That works!


Thanks a million!
 
Old 05-03-2011, 08:54 PM   #4
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Original Poster
Rep: Reputation: 23
Do you know of any good books that will give a foundation of bash scripting that you can build on.

This is my weakest area of all, I have not grasped the concept or fundamentals.

Any advice/help would be great.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix: forward all account email within domain to another email account? 18Googol2 Linux - Software 3 03-04-2011 01:10 PM
cyrus email account linux account nobu Linux - Enterprise 0 10-31-2005 03:16 AM
using multiple email programs for one email account kshaffer Linux - Software 1 01-07-2005 05:00 PM
Creating A Second Email Address For Email Account On Sendmail treedstang Linux - Software 1 04-27-2004 10:31 PM
Email account ... JMK Linux - Newbie 2 03-12-2004 04:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration