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 9227855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:10:58+00:00 2026-06-18T05:10:58+00:00

So I am trying to read in a file that has a bunch of

  • 0

So I am trying to read in a file that has a bunch of lines with an email address and then a nickname in them. I am trying to extract this nickname, which is surrounded by parentheses, like below

email@somewhere.com (Tom)

so my thought was just to use cut to get at the word Tom, but this is foiled when I end up with something like the following

email2@somewhereElse.com ("Bob")

Because Bob has quotes around it, the cut command fails as follows

cut: <file>: Illegal byte sequence

Does anyone know of a better way of doing this? or a way to solve this problem?

  • 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-18T05:10:59+00:00Added an answer on June 18, 2026 at 5:10 am

    I think that

    grep -o '(.*)' emailFile 
    

    should do it. “Go through all lines in the file. Look for a sequence that starts with open parens, then any characters until close parens. Echo the bit that matches the string to stdout.”

    This preserves the quotes around the nickname… as well as the brackets. If you don’t want those, you can strip them:

    grep -o '(.*)' emailFile | sed 's/[(")]//g'
    

    (“replace any of the characters between square brackets with nothing, everywhere”)

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

Sidebar

Related Questions

I’m trying to read a text file that has 1147 lines. The code below
I am trying to read strings from a file that has each string on
I am trying to read and sort a csv file that has data that
I'm trying to read a csv file into R that has date values in
I'm trying to read the data from a file that I've saved. This code
I am trying to read a file that has been saved on the /system
I am trying to read an ini file that has the following format: SETTING=VALUE
I'm facing this strange problem. I'm trying to read a file that is located
I am reading a file that has 10,000 int values and then trying to
I have a zip file that I'm trying to read the contents of, which

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.