Got tired of doing this manually in excel, so thought I'd try doing it in bash for fun.
So I have a roughly 30K line .csv file. I need to strip out the 3rd column (already done using "csvfilter" and passing it to a new file).
Next I need to sort it alphabetically by the 1st column, done easily enough with "sort -k1 -t"
What I want to do next is a bit trickier, and I'm at a loss as to the best way to do it. Basically, I want to take the 1st few characters of "Column A", and when they change, add a blank line or otherwise create a separator.
Essentially, my file is a list of machine names, which follow a pattern where the 1st 4-5 characters are common to each office. I'm trying to divide my file up by office by sorting it, then separating it when the 1st characters change.
Thoughts?
If anyone has a simple way to do it in vbscript, that would work as well, but I'm really trying to force myself to use bash more and more so thus the exercise.
So I have a roughly 30K line .csv file. I need to strip out the 3rd column (already done using "csvfilter" and passing it to a new file).
Next I need to sort it alphabetically by the 1st column, done easily enough with "sort -k1 -t"
What I want to do next is a bit trickier, and I'm at a loss as to the best way to do it. Basically, I want to take the 1st few characters of "Column A", and when they change, add a blank line or otherwise create a separator.
Essentially, my file is a list of machine names, which follow a pattern where the 1st 4-5 characters are common to each office. I'm trying to divide my file up by office by sorting it, then separating it when the 1st characters change.
Thoughts?
If anyone has a simple way to do it in vbscript, that would work as well, but I'm really trying to force myself to use bash more and more so thus the exercise.