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
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 …
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.1you’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.