Quote:
|
Originally Posted by rraajjiibb
I have a file with each line containing 53 fields separated by semicolons.
I need to extract the matching lines based on matching values from a particular column AND /OR some logical combination of pattern matches from a couple of columns.
In short I want to run SQL like queries on this file .... but from UNIX .
The data looks like as attached
3;10115950;611261;106440;3;8d2d9522;2230982599;123 2600248;0;65;2;1;43;65;2;1;43;
1641;65;7;0;23811450;2;2;2;2;2;1;0;3;3;994;518;7;0 ;2;2;1;1;0;140;0;0;0;4;3;0;0;0
;0;0;0;2;25;27;
3;10115951;612309;1100;1;8d31de39;2230983737;12326 02026;0;33;2;1;34;33;2;1;34;0;
0;0;0;982014290;2;2;2;0;2;1;0;3;3;995;823;7;0;2;0; 1;2;0;56;0;0;0;0;0;0;0;0;0;0;0
;1;25;
3;10115952;612347;0;59;0;2233498694;0;2233498694;0 ;0;0;0;0;0;0;0;1885;230;7;0;0;
0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;8;0;0;0;0;0;0;0;0; 0;0;0;0;4802828128;0;
3;10115953;611938;40797;3;44f2a266;2234358432;1075 033834;0;12;2;2;2;12;2;2;2;617
;69;7;1;02234204762;2;2;1;1;1;1;0;3;3;993;894;7;0; 2;2;1;1;0;84;0;0;0;3;3;0;0;0;0
;0;0;2;25;27;
......
Pl help
|
Try awk.
You can do something like awk -F ";" '{ if ($5==3 || $5==1) print $0}'. It should print all lines with the fifth column being 3 or 1.
You can also define external variables and functions. See the man page for details.
Hope this helps
Iņaki