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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:08:03+00:00 2026-05-25T23:08:03+00:00

Recently I have been using alot of text files (csv) with 10-60k lines, something

  • 0

Recently I have been using alot of text files (csv) with 10-60k lines, something like this

id1,id2  
id3,id1  
id81,id13  
...

And most of the times, I need to extract this informaton in form of an array:

id1,id2,id3,id1,id81,id13

Or at times, unique elements array:

id1,id2,id3,id81

Then the result is used by my code (java) to do something.

Now, most of the times I write a java function which does the task for me, right from file reading, logic and then returning back the list of Ids.

Is there is a better and a quicker way to achieve this, maybe via command line?

Update:

If I was asked to build an app which was supposed to read a file and do something with it, I will surely write that logic in Java, but in my case I have to go through alot of text files which I get from the data warehouse, extract relevant info from it and then run it over my java based app.

Now, this is only for my experiment and evaluation of my app.

  • 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-05-25T23:08:03+00:00Added an answer on May 25, 2026 at 11:08 pm

    I copied your input in a file, test.csv:

    $ cat test.csv 
    id1,id2  
    id3,id1  
    id81,id13  
    

    Now, with the ‘tr’ utility, you can do:

    $ cat test.csv | tr '\n' ',' | tr -d ' '
    

    and you have:

    id1,id2,id3,id1,id81,id13
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently been using WxPython to create a GUI Network simulator like Cisco
I have been using git a lot recently and I quite like the concept
I have been using Clojure alot recently but I still don't understand what functionality
I have been using NotePAD++ for editing Python scripts. I recently downloaded the PyDEV
I recently downloaded the Android Support Package and have been using it trying to
I have only recently started using CakePHP and have been unable to get validation
Recently I have been trying to optimize my tables, mainly because I've learned alot
I have been experimenting recently with Silverlight, RIA Services, and Entity Framework using .NET
Recently I have been using thrust a lot. I have noticed that in order
Folks, I had a quick question about Amazon EC2, I have been recently using

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.