Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8678753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:48:10+00:00 2026-06-12T20:48:10+00:00

I need to search through a directory, ARCHIVE, which contains many sub directories, each

  • 0

I need to search through a directory, ARCHIVE, which contains many sub directories, each which contain files. Each file has an email address in it. I want to list all of the email address’, with the @blah.com truncated, then list the occurrences for each name.

I figured out how to find the emails and truncate the @ part, but I can’t figure out how to count how many times each individual name occurs.

grep -R '^To: ' $ARCHIVE | cut -d@ -f1 | awk  '{print $2}' | sort | uniq

Also for some reason I can’t get this to work in a script; whenever I call it it does nothing, but if I put it in the command line it works.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:48:11+00:00Added an answer on June 12, 2026 at 8:48 pm

    So with our long comment conversation I would do this:

    grep -R '^To: ' $ARCHIVE | cut -d@ -f1 | awk  '{print $2}' | sort | uniq -c > ind.txt && wc -l ind.txt >> ind.txt
    

    This will take the output of the uniq command, write it to a file and then gather a total and append it to the same file for you to see at the bottom.

    Or as Geoff pointed out you could do uniq -c file.txt | awk '{print}END{print NR}'.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to search through a directory which contains many sub directories, each which
I am trying to recursively search through a directory for all sub-directories within any
I need a regular expression utility that will search through a specified directory and
I have a directory with nearly 1,200 files. I need to successively go through
I use file_get_contents(http://www.mydomain.com); to get the content. Then I need to search through it
I need to be able to search through multiple 2D arrays and search the
This below goes through files in a directory, reads them and saves them in
I have a large filesystem that I need to traverse for errors. Each file
Is there an easy way for me to automatically search recursively through a directory
Hey everyone. I need to write a POSIX program to search through an entire

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.