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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:07:53+00:00 2026-06-18T12:07:53+00:00

I have a pipe-delimited text file containing about 900 rows of data. Each row

  • 0

I have a pipe-delimited text file containing about 900 rows of data. Each row contains a set of numbers with a username at the end. e.g.

2792|5750|125|4.0|0.25|||6|2|user1
2802|6000|126|4.0|0.25|||2|3|user2
2801|6000|125|4.0|0.25|||4|4|user2
2805|5500|125|4.5|0.25|||3|2|user1
2805|6250|122|4.5|0.25|||4|7|user3
2811|4750|125|3.0|0.25|||4|2|user1
2828|5750|121|4.0|0.25|||6|2|user2

What I would like to do is create three new files: one for each of the users, containing only their data. (e.g. the file for user1 would contain only the first, fourth, and sixth line of the original file). Should I use awk or sed to do this?

  • 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-18T12:07:54+00:00Added an answer on June 18, 2026 at 12:07 pm

    One way:

    awk -F "|" '{ print > $NF }' file
    

    Here’s the results of grep . user*:

    user1:2792|5750|125|4.0|0.25|||6|2|user1
    user1:2805|5500|125|4.5|0.25|||3|2|user1
    user1:2811|4750|125|3.0|0.25|||4|2|user1
    user2:2802|6000|126|4.0|0.25|||2|3|user2
    user2:2801|6000|125|4.0|0.25|||4|4|user2
    user2:2828|5750|121|4.0|0.25|||6|2|user2
    user3:2805|6250|122|4.5|0.25|||4|7|user3
    

    Also, some people like to add a file extension. This can be done like:

    awk -F "|" '{ print > $NF ".txt" }' file
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi guys i have two pipe delimited files,first file contains 1000 records and second
If I have 2 pipe delimited files containing bookmark data, for example. How can
I have a pipe delimited text file as shown below, which I need to
Here's the situation, I have a text file that is pipe-delimited and one of
I have a form that will ultimately create a pipe delimited text file. The
My indexed documents have a field containing a pipe-delimited set of ids: a845497737704e8ab439dd410e7f1328| 0a2d7192f75148cca89b6df58fcf2e54|
I have a Perl script inserting data into Postgres according to a pipe delimited
I am trying to save a pipe delimited text file into an excel worksheet
We currently have certain logs composed of pipe-delimited text, which has the format field1:value1|field2:value2|...|fieldN:valueN\n
I have a pipe delimited file with some NULL date fields. I load this

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.