Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


Hi Charles,

There are a few ways of doing this that I can think of. First, you
could use the linux sort utility, that does let one sort by columns, so
the second column in your case. There are two different ports of that to
win32 here:

http://gnuwin32.sourceforge.net/packages/coreutils.htm
http://unxutils.sourceforge.net/

Or you can get it using cygwin:

http://www.cygwin.com/

Both those options would be from the command line. Other programs, like
vim, can also sort for you:

http://www.vim.org/download.php

It can be done in Calc, too, but I'm not sure about doing it from the
command line.

In Calc, if you open the file, you should get the text import dialog,
and you should be able to specify a space as the field separator. Then,
simply select all the data, from first row to last and first column to
last, and go to "Data | Sort". In the sort dialog, choose the second
column as the first sort key. If the second column on its own is likely
to have duplicates, set the third column as the second sort key. Repeat
for as many columns as necessary to ensure that you will have unique
sort keys.

As I said, it can be done in Calc, but I don't see how that could be
done from the command line. If you really want the command line, my
advice would be to install one of the win32 ports of unix tools, and
use that sort command.

Hope this helps

Paul



On Mon, 17 Mar 2014 14:32:15 -0400
Tanstaafl <tanstaafl@libertytrek.org> wrote:

Hi all,

I'm working on a little problem that I'd really like to resolve. It 
doesn't really have anything to do with Libreoffice, other than I 
thought I might be able to use Calc to do the sort...

I have a text file. Each line is one record.

I can use the raw windows Sort command to sort the file, and that
works fine, but I need to sort it based on the second column, not the
first, and the windows sort command doesn't allow this.

The columns are separated by a space, but to complicate matters, the 
second column can contain multiple space separated words.

All I need to do is sort the file based on the text found AFTER the 
first space on each line (ie, the second column).

Is it maybe possible to do this somehow with Calc on the command line?

Or, does anyone have any other ideas?

Thanks,

Charles



-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.