I have another question. In my original awk statement I took for granted that there won't be more that 4 fields. However I ran into a situation where I won't know how many fields there can be.
Example
test2 test4 test5 100000837474
could be
test2 test4 test5 test6 test7 100000837474
So I was thinking how can I check the line for the first occurrence of a numeric variable.?
---------- Post updated at 12:14 PM ---------- Previous update was at 12:07 PM ----------
I have another issue where I thought that I won't have more than 4 fields. It turns out I won't know how many fields I will have. How can I check the line for the first occurrence of a numeric variable with awk??
I did not try #4. I figured that out.
What I need to do now is look at the number in my file and determine if it is bigger than 1TB. However it now appears that it won't only be 4 fields. It can be more than that.
So I need a way to check the number.
I figured if I can fo through the line and when it is numeric check the size.
Orginal file
test test2 1000000657373
test1 test3 1000003849450
test2 test4 test5 100000837474
I tried to rearrange the output but now I put the actual output on. So to make it easier to understand. So the actual output is what I put. Been trying all sorts of stuff.
I don't use awk that often so I don't know all the tricks to it.
So please rephrase your initial problem carefully, based on real data, and supply a representative input file and a desired output. There is nothing more annoying than to work on "moving targets", i.e. a sample file that all of a sudden is not valid any more and you have to start over with proposals!
To get at number fields using awk, try the following (you can e.g. break after the first number encountered):