This question already has an answer here:
I have seen solutions of splitting a file with respect to pattern matching and line matching but what I want is the following.
The scenario is, let's say I have a file
A.B|100|20 A.B|101|20 A.X|101|30 A.X|1000|20 B.Y|1|1
Now I want to split this file into 3 different files just based on the first column where the 1st file would be all the lines containing
A.B in the first column, the 2nd file should have all the lines with
A.X and so on.
If the first column changes in any way, there should be a new file created for those lines. Is there any way of doing it with
Since there is no way of actually knowing before hand what the first column value is, I wasn't able to use any feature like
cut. Thanks for the help in advance!