Data manipulation
Hi there,
I have a bit of a problem with data manipulation below is the output, would it be possible to use a joint command or anything else to produce output file where the numbers in the middle columns mach each other like the first record in the input file. Code:
Input |
I can't see the logic based on what you have shown. At first I thought you meant "write the line to output if cols 2 and 3 are the same".
You will need to describe the logic (algorithm) in more detail. |
There's more than one way to do it, obviously. (Hope I don't sound too much like a Perl-conversant programmer when I say that.) And there are several very powerful tools you can consider.
For example, in any Unix/Linux environment you can use the notion of "piping the output of one program into another" to do things like sorting your input and then processing it. Lots of programs know how to "accept input from STDIN and send it to STDOUT." One very powerful tool is awk (see: man tt) which is specifically designed for dealing with text files. It is based on a disarmingly-simple premise that is astonishingly useful and powerful. A step up from that is Perl, a genuine programming-language that is somewhat of "awk on super-steroids." Start by considering your problem: describe it in terms of an algorithm that can be applied in order to solve it. In Linux/Unix, it is not a question of lacking for the tools to get the job done! The question is merely, how you wish to go about doing it. |
All times are GMT -5. The time now is 04:57 AM. |