[libreoffice-users] OT: Windows, sort text file, can I use LibO maybe?

2014-03-17 Thread Tanstaafl

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+unsubscr...@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


Re: [libreoffice-users] OT: Windows, sort text file, can I use LibO maybe?

2014-03-17 Thread Jay Lozier


On 03/17/2014 02:32 PM, Tanstaafl 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


Charles,

The problem is the second column. Can you regenerate the text file 
easily such as requerying a database and saving the file with column 
delimiter such as colon, semicolon, or tab?


If not and the file is not very large or has patterns. you can use, you 
can open it to text editor like Notepad. Then systematically replace 
each pattern such as 0 a with 0;a using Find/Replace.


Along this line if you know a scripting language such as Python, Ruby, 
or Perl a script using regular expressions might work.


Once the file has been cleaned up, Calc can do the data sorting.

--
Jay Lozier
jsloz...@gmail.com


--
To unsubscribe e-mail to: users+unsubscr...@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


Re: [libreoffice-users] OT: Windows, sort text file, can I use LibO maybe?

2014-03-17 Thread Paul
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 tansta...@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+unsubscr...@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



Re: [libreoffice-users] OT: Windows, sort text file, can I use LibO maybe?

2014-03-17 Thread Dave Liesse
Actually, this can be done more easily in Writer.  You have to select 
the text to be sorted, then choose Tools...Sort.


The trick is to adjust the sort parameters in the dialog window. For 
Key1 you want to select column 2 (default is 1), then choose the 
Character radio button, click on the ellipsis, and select the space 
character (the second empty box; the first one is a carriage return).


This won't necessarily sort the third and subsequent words, but if 
necessary the sorted blocks of text can be further sorted and refined 
(just sort on column 3, then 4, and so long until done).  A bit of work, 
but easier than writing a script in a language you don't know!


Dave


On 3/17/2014 11:51, Jay Lozier wrote:


On 03/17/2014 02:32 PM, Tanstaafl 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


Charles,

The problem is the second column. Can you regenerate the text file 
easily such as requerying a database and saving the file with column 
delimiter such as colon, semicolon, or tab?


If not and the file is not very large or has patterns. you can use, 
you can open it to text editor like Notepad. Then systematically 
replace each pattern such as 0 a with 0;a using Find/Replace.


Along this line if you know a scripting language such as Python, Ruby, 
or Perl a script using regular expressions might work.


Once the file has been cleaned up, Calc can do the data sorting.




--
To unsubscribe e-mail to: users+unsubscr...@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


Re: [libreoffice-users] OT: Windows, sort text file, can I use LibO maybe?

2014-03-17 Thread Tanstaafl

Hi Paul,

Actually, I *think* that will work perfectly, thanks!

If anyone cares, what this if for is...

I use a really cool little free PortableApp called 'RemoteControl' 
(based on the old 'GenControl' app), that allows me to connect to and 
remotely control any PC in our network (only works in a domain 
environment), quickly and easily, no passwords needed (as long as I'm 
logged on with a Domain Admin account).


It makes providing remote support for our users sooo much easier 
than Remote Support sessions.


But, the biggest problem is it doesn't provide any way to sort the list 
oif computers - so it always takes me anywhere from 5 or 10 seconds to 
30+ seconds to find someone in the list.


The app stores the list of computers in a little txt file (it actually 
has a .tmp extension), and that is the file I want to sort.


I figured out how to get it to sort automatically every time I launch 
the App (wrote a little batch file to do the sort, then launch the App), 
but the Windows sort command is brain-dead and will only sort on the 
first column, which for this App, is the workstation name, rather than 
the Description (where I put the Users name).


I'll let you know if this works (fingers crossed)...

Thanks again Paul!

Charles

On 3/17/2014 2:57 PM, Paul paulste...@afrihost.co.za wrote:

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 tansta...@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+unsubscr...@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



Re: [libreoffice-users] OT: Windows, sort text file, can I use LibO maybe?

2014-03-17 Thread Tanstaafl

Paul,

Many, many thanks! Works perfectly, and this will make finding the right 
computer so much easier!


Thanks to the others who replied, but I did need a command line tool, 
and I'm sure the GNU tools will come in handy for other things too...


Thanks again Paul!

Charles

On 3/17/2014 3:41 PM, Tanstaafl tansta...@libertytrek.org wrote:

Hi Paul,

Actually, I *think* that will work perfectly, thanks!

If anyone cares, what this if for is...

I use a really cool little free PortableApp called 'RemoteControl'
(based on the old 'GenControl' app), that allows me to connect to and
remotely control any PC in our network (only works in a domain
environment), quickly and easily, no passwords needed (as long as I'm
logged on with a Domain Admin account).

It makes providing remote support for our users sooo much easier
than Remote Support sessions.

But, the biggest problem is it doesn't provide any way to sort the list
oif computers - so it always takes me anywhere from 5 or 10 seconds to
30+ seconds to find someone in the list.

The app stores the list of computers in a little txt file (it actually
has a .tmp extension), and that is the file I want to sort.

I figured out how to get it to sort automatically every time I launch
the App (wrote a little batch file to do the sort, then launch the App),
but the Windows sort command is brain-dead and will only sort on the
first column, which for this App, is the workstation name, rather than
the Description (where I put the Users name).

I'll let you know if this works (fingers crossed)...

Thanks again Paul!

Charles

On 3/17/2014 2:57 PM, Paul paulste...@afrihost.co.za wrote:

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 tansta...@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+unsubscr...@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