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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:11:32+00:00 2026-05-24T10:11:32+00:00

I have files with some columns filled by numbers (float). I would need to

  • 0

I have files with some columns filled by numbers (float). I would need to split these files according to the value in one of the columns (can set as the first one). This means, when

a b c

in my file the value c fullfils 0.05<=c<=0.1 then create the file named c and copy the whole columns there which fullfils the c-condition…
is this possible? I can something small with bash, awk, something also with c++.
I have searched for some solutions but – I can the data sort of course and only read the first number of the line..
I don’t know.
Please, very please.
Thank you
Jane

  • 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-24T10:11:34+00:00Added an answer on May 24, 2026 at 10:11 am

    As you mentioned awk, the basic rule in awk is ‘match a line (either by default or with a regexp, condition or line number)’ AND ‘do something because you found a match’.

    awk uses values like $1, $2, $3 to indicate which column in the current line of data it is looking at. $0 refers to the whole line. So …

    awk '
     BEGIN{
        afile="afile.txt"
        bfile="bfile.txt"
        cfile="cfile.txt"
     }
    
    {
      # test c value between .05 and .1
      if ($3 >= 0.05 && $3 <= 0.1) print $0 > cfile
    } inputData
    

    Note that I am testing the value of the third column (c in your example). You can use $2 to test b column, etc.

    If you don’t know about the sort of condition test I have included >= 0.5 && $3 <= 0.1 you’ll have some learning ahead of you.

    Questions in the form of 1. I have this input, 2. I want this output. 3. (but) I’m getting this output, 4. with this code …. {code here} …. have a much better chance of getting a reasonable response in a reasonable amount of time 😉

    I hope this helps.

    P.S. as you appear to be a new user, if you get an answer that helps you please remember to mark it as accepted, and/or give it a + (or -) as a useful answer.

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

Sidebar

Related Questions

We have some files on our website that users of our software can download.
I have some files that are uuencoded, and I need to decode them, using
I have some files in my SVN repository that I would like to have
I have to read some external files, extract some columns and complete the missing
I have some CLOB columns in a database that I need to put Base64
i have some data files, and i need to pull some info out. i'd
I have some files stored in a database blob column in Oracle 9. I
I have some files stored at amazon. all in private mode, and since I
i have some files located in c:\MyApp\file.txt and current executing assenbly in in debud
I have some files: core.php : require_once 'logger.php'; require_once 'smth_else.php'; $Logger = new Logger();

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.