A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows 7 » Windows 7 Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Can I flip the order of text with a Windows program?



 
 
Thread Tools Rate Thread Display Modes
  #16  
Old April 8th 12, 01:08 AM posted to alt.windows7.general
metspitzer
external usenet poster
 
Posts: 580
Default Can I flip the order of text with a Windows program?

On Sat, 07 Apr 2012 19:31:55 -0400, Wolf K
wrote:

On 07/04/2012 6:07 PM, Metspitzer wrote:
[...]
It does have dates but sometimes I used the month day year and
sometimes only month and year.

They are listed in chronological order.


When using a spreadsheet, you have to be careful to specify the cell
format as "date", specify the date format you will use, and never, ever
depart from it. Otherwise, the items won't sort correctly by date.

You can "sort by paragraph" in a word-processor, ie, you end each item
with "Enter", which makes it a paragraph. Place the date at the
beginning, and use leading zeroes, otherwise November 8, 2011 (11-8-12)
will sort before August 4, 2010 (8-4-10). But 11-08-12 will sort
correctly after 02-02-10.

However, if you want to ensure the items are sorted correctly by year,
you'll have to use year-month-day (yyyy-mm-dd).

HTH,
Wolf K.


Thanks
Ads
  #17  
Old April 8th 12, 04:15 AM posted to alt.windows7.general
richard
external usenet poster
 
Posts: 177
Default Can I flip the order of text with a Windows program?

On Sat, 07 Apr 2012 16:21:13 -0700, Gene E. Bloch wrote:

On 4/07/2012, richard posted:
On Sat, 07 Apr 2012 15:47:17 -0400, Metspitzer wrote:


I started a list in chronological order with older first. I would
like to switch to newest first. Most of it is a single line. Can
this be done with Windows?


Use the spread sheet in "open office" (free).
Copy the text to a column and sort.
But sorts in spread sheets usually do so in alphabetical order.


Or numerical or by date. Maybe other sort types too, but those are the
three I have used. On a daily basis, BTW.

So if you had something that was not exactly alphabetical to begin with,
then sorting via spreadsheet will not do what you want.


Many people in this thread have offered a suggestion that *will* do
what he wants in a spreadsheet program


Chronological is not the same as alphabetical.
Spreadsheets sort by alpha or numeric.

Let's say you have the months of the year as your list and you want to
reverse order that list.

e.g:
Jan
Feb
Mar
Apr

Now you want the list to show:
Apr
Mar
Feb
Jan

A spreadsheet would show:
Apr
Feb
Jan
Mar

or
Mar
Jan
Feb
Apr

Liberty Basic's string manipulation routines can show that list any way you
want it.

  #18  
Old April 8th 12, 05:07 AM posted to alt.windows7.general
Char Jackson
external usenet poster
 
Posts: 10,449
Default Can I flip the order of text with a Windows program?

On Sat, 7 Apr 2012 23:15:10 -0400, richard wrote:

On Sat, 07 Apr 2012 16:21:13 -0700, Gene E. Bloch wrote:

On 4/07/2012, richard posted:
On Sat, 07 Apr 2012 15:47:17 -0400, Metspitzer wrote:


I started a list in chronological order with older first. I would
like to switch to newest first. Most of it is a single line. Can
this be done with Windows?


Use the spread sheet in "open office" (free).
Copy the text to a column and sort.
But sorts in spread sheets usually do so in alphabetical order.


Or numerical or by date. Maybe other sort types too, but those are the
three I have used. On a daily basis, BTW.

So if you had something that was not exactly alphabetical to begin with,
then sorting via spreadsheet will not do what you want.


Many people in this thread have offered a suggestion that *will* do
what he wants in a spreadsheet program


Chronological is not the same as alphabetical.
Spreadsheets sort by alpha or numeric.

Let's say you have the months of the year as your list and you want to
reverse order that list.

e.g:
Jan
Feb
Mar
Apr

Now you want the list to show:
Apr
Mar
Feb
Jan

A spreadsheet would show:
Apr
Feb
Jan
Mar

or
Mar
Jan
Feb
Apr

Liberty Basic's string manipulation routines can show that list any way you
want it.


Your problem is that you're limiting your sorting to alphabetic. If
you tell your spreadsheet program to treat those values as dates
you'll be able to sort them chronologically.

--

Char Jackson
  #19  
Old April 8th 12, 06:08 AM posted to alt.windows7.general
Steve Hayes[_2_]
external usenet poster
 
Posts: 1,089
Default Can I flip the order of text with a Windows program?

On Sat, 07 Apr 2012 15:47:17 -0400, Metspitzer wrote:

I started a list in chronological order with older first. I would
like to switch to newest first. Most of it is a single line. Can
this be done with Windows?


Most decent word processors can do that, but I don't think Windows on its own
can. You might be able to write a batch file to do it.


--
Steve Hayes from Tshwane, South Africa
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk
  #20  
Old April 8th 12, 06:47 AM posted to alt.windows7.general
Paul
external usenet poster
 
Posts: 18,275
Default Can I flip the order of text with a Windows program?

Metspitzer wrote:
On Sat, 07 Apr 2012 19:31:55 -0400, Wolf K
wrote:

On 07/04/2012 6:07 PM, Metspitzer wrote:
[...]
It does have dates but sometimes I used the month day year and
sometimes only month and year.

They are listed in chronological order.

When using a spreadsheet, you have to be careful to specify the cell
format as "date", specify the date format you will use, and never, ever
depart from it. Otherwise, the items won't sort correctly by date.

You can "sort by paragraph" in a word-processor, ie, you end each item
with "Enter", which makes it a paragraph. Place the date at the
beginning, and use leading zeroes, otherwise November 8, 2011 (11-8-12)
will sort before August 4, 2010 (8-4-10). But 11-08-12 will sort
correctly after 02-02-10.

However, if you want to ensure the items are sorted correctly by year,
you'll have to use year-month-day (yyyy-mm-dd).

HTH,
Wolf K.


Thanks


You can use a port of "sort".

There is a sort in Coreutils package.

http://gnuwin32.sourceforge.net/packages.html

This is the contents of my download directory.

http://img69.imageshack.us/img69/3088/coreutils.gif

The "...bin.zip" package holds "sort.exe" file.
The "...dep.zip" package has the support DLLs (dependencies) libiconv2.dll and libintl3.dll
The "...doc.zip" package has things like the PDF files.

To work from a Command Prompt window, the three files (.exe and two DLLs)
have to be in the %PATH%. If they're in the same directory as the
data you're working on, then you should be OK then. CD (change directory)
to the folder with both program and data file, and away you go.

Sort works best, if each line can be separated into fields,
and you then tell sort which field to sort on. It can
get quite complicated, getting sort to do a good job. But
if your file has any size at all, it's worth it. And on
modern computers, it takes no time at all to run.

I think Sort has a "unique" option, whereby multiple identical
lines next to each other, can be removed. The Coreutils package
also has a copy of uniq.exe, which will also remove identical lines
from a file.

apple apple
baker -------- baker
baker uniq.exe dog
dog

Of course you're not going to use it, but it's nice to know it's there.
(It's a ported program from Unix/Linux, and I expect, quite old.)

I also have a scripting language, with a "sort" in it, but that's even
more obscure.

*******

Spreadsheets are the way to go with sorting, because then you get your
"columns" in order. To use a spreadsheet, you need a delimiter to separate
the columns. Some people, when preparing lists, use "tab separation" between
each column. And the sorting tools, spreadsheets or programs, can also be
instructed to use the delimiter of your choice. The last time I had some
data to delimit, I used "|" vertical bar, but tabs or commas are also
popular ways to separate the fields.

*******

When you ask a question like this, it helps to provide a couple bogus
example lines you wanted sorted. And then indicate the first field to
sort on, the second field to sort on, and so on. Perhaps you'd want
"date, last name, first name" or somesuch. And then people can see
what kind of tool makes it easy or hard. Computers are not miracle
workers, and if the information is in a variety of formats (like several
kinds of date fields, not just one format), you'd need something pretty
fancy to fix it. (In this example, \t means "tab" character.) This
example would actually be pretty miserable to deal with. A first step,
would be replacing the "," with a tab perhaps, which you might be
able to do in your text editor.

Doe, John \t Dec.05,2012 \t Plumber \t Tulsa
Lou, Mary \t Apr.01,2012 \t Carpenter \t Boise

HTH,
Paul
  #21  
Old April 8th 12, 10:18 AM posted to alt.windows7.general
VanguardLH[_2_]
external usenet poster
 
Posts: 10,881
Default Can I flip the order of text with a Windows program?

Metspitzer wrote:

I started a list in chronological order with older first. I would
like to switch to newest first. Most of it is a single line. Can
this be done with Windows?


Does "text" mean it is a text file where you have the lines of strings
you want to reverse their sorting order? If so, in a command shell,
run:

sort /?
  #22  
Old April 8th 12, 12:44 PM posted to alt.windows7.general
J. P. Gilliver (John)
external usenet poster
 
Posts: 5,291
Default Can I flip the order of text with a Windows program?

In message , Steve Hayes
writes:
On Sat, 07 Apr 2012 15:47:17 -0400, Metspitzer wrote:

I started a list in chronological order with older first. I would
like to switch to newest first. Most of it is a single line. Can
this be done with Windows?


Most decent word processors can do that, but I don't think Windows on its own
can. You might be able to write a batch file to do it.


How would you do it in Word, WordPerfect, or WordPad? My understanding
is that he wants to change some text

with lines
in it
like this

so that it looks thus

like this
in it
with lines

and I certainly don't know how I'd do that in any word processor I use.
(I'd probably use the suggestion others have made of putting it into
Excel or another spreadsheet, adding a number column, reverse sorting on
that column, then either deleting that column before saving back or
saving back excluding that column.)
--
J. P. Gilliver. UMRA: 1960/1985 MB++G.5AL-IS-P--Ch++(p)Ar@T0H+Sh0!:`)DNAf

"Don't worry about people stealing your ideas. If your ideas are any good,
you'll have to ram them down people's throats." - Howard Aiken
  #23  
Old April 8th 12, 01:46 PM posted to alt.windows7.general
Stewart[_4_]
external usenet poster
 
Posts: 64
Default Can I flip the order of text with a Windows program?


"Metspitzer" wrote in message
...
On Sat, 07 Apr 2012 13:32:32 -0700, Ken Blake
wrote:

On Sat, 07 Apr 2012 15:47:17 -0400, Metspitzer

wrote:

I started a list in chronological order with older first. I would
like to switch to newest first. Most of it is a single line. Can
this be done with Windows?




Windows isn't the issue. The issue is with what program you are
using.
Please tell us what it is.


It is a text file. I wanted to use Wordpad or Notepad or something
else included in Windows.


Pull it into a spreadsheet.


  #24  
Old April 8th 12, 02:47 PM posted to alt.windows7.general
ray
external usenet poster
 
Posts: 465
Default Can I flip the order of text with a Windows program?

On Sun, 08 Apr 2012 01:47:50 -0400, Paul wrote:

Metspitzer wrote:
On Sat, 07 Apr 2012 19:31:55 -0400, Wolf K
wrote:

On 07/04/2012 6:07 PM, Metspitzer wrote: [...]
It does have dates but sometimes I used the month day year and
sometimes only month and year.

They are listed in chronological order.
When using a spreadsheet, you have to be careful to specify the cell
format as "date", specify the date format you will use, and never,
ever depart from it. Otherwise, the items won't sort correctly by
date.

You can "sort by paragraph" in a word-processor, ie, you end each item
with "Enter", which makes it a paragraph. Place the date at the
beginning, and use leading zeroes, otherwise November 8, 2011
(11-8-12) will sort before August 4, 2010 (8-4-10). But 11-08-12 will
sort correctly after 02-02-10.

However, if you want to ensure the items are sorted correctly by year,
you'll have to use year-month-day (yyyy-mm-dd).

HTH,
Wolf K.


Thanks


You can use a port of "sort".

There is a sort in Coreutils package.

http://gnuwin32.sourceforge.net/packages.html

This is the contents of my download directory.

http://img69.imageshack.us/img69/3088/coreutils.gif

The "...bin.zip" package holds "sort.exe" file. The "...dep.zip" package
has the support DLLs (dependencies) libiconv2.dll and libintl3.dll The
"...doc.zip" package has things like the PDF files.

To work from a Command Prompt window, the three files (.exe and two
DLLs) have to be in the %PATH%. If they're in the same directory as the
data you're working on, then you should be OK then. CD (change
directory) to the folder with both program and data file, and away you
go.

Sort works best, if each line can be separated into fields, and you then
tell sort which field to sort on. It can get quite complicated, getting
sort to do a good job. But if your file has any size at all, it's worth
it. And on modern computers, it takes no time at all to run.

I think Sort has a "unique" option, whereby multiple identical lines
next to each other, can be removed. The Coreutils package also has a
copy of uniq.exe, which will also remove identical lines from a file.

apple apple
baker -------- baker
baker uniq.exe dog
dog

Of course you're not going to use it, but it's nice to know it's there.
(It's a ported program from Unix/Linux, and I expect, quite old.)

I also have a scripting language, with a "sort" in it, but that's even
more obscure.

*******

Spreadsheets are the way to go with sorting, because then you get your
"columns" in order. To use a spreadsheet, you need a delimiter to
separate the columns. Some people, when preparing lists, use "tab
separation" between each column. And the sorting tools, spreadsheets or
programs, can also be instructed to use the delimiter of your choice.
The last time I had some data to delimit, I used "|" vertical bar, but
tabs or commas are also popular ways to separate the fields.

*******

When you ask a question like this, it helps to provide a couple bogus
example lines you wanted sorted. And then indicate the first field to
sort on, the second field to sort on, and so on. Perhaps you'd want
"date, last name, first name" or somesuch. And then people can see what
kind of tool makes it easy or hard. Computers are not miracle workers,
and if the information is in a variety of formats (like several kinds of
date fields, not just one format), you'd need something pretty fancy to
fix it. (In this example, \t means "tab" character.) This example would
actually be pretty miserable to deal with. A first step, would be
replacing the "," with a tab perhaps, which you might be able to do in
your text editor.

Doe, John \t Dec.05,2012 \t Plumber \t Tulsa Lou, Mary \t
Apr.01,2012 \t Carpenter \t Boise

HTH,
Paul


Don't know if it's included, but 'tac' (backwards cat) does nothing more
than reverse the order of lines in a file. That would obviously be the
simplest solution.
  #25  
Old April 8th 12, 03:54 PM posted to alt.windows7.general
Ken Blake[_4_]
external usenet poster
 
Posts: 3,318
Default Can I flip the order of text with a Windows program?

On Sun, 8 Apr 2012 12:44:38 +0100, "J. P. Gilliver (John)"
wrote:

In message , Steve Hayes
writes:
On Sat, 07 Apr 2012 15:47:17 -0400, Metspitzer wrote:

I started a list in chronological order with older first. I would
like to switch to newest first. Most of it is a single line. Can
this be done with Windows?


Most decent word processors can do that, but I don't think Windows on its own
can. You might be able to write a batch file to do it.


How would you do it in Word, WordPerfect, or WordPad? My understanding
is that he wants to change some text

with lines
in it
like this

so that it looks thus

like this
in it
with lines

and I certainly don't know how I'd do that in any word processor I use.




I use WordPerfect X5. I just pasted

with lines
in it
like this

into a blank document and clicked Tools|Sort. It sorted it to

like this
in it
with lines


And I remember doing the same thing with older version of WordPerfect.

  #26  
Old April 8th 12, 04:33 PM posted to alt.windows7.general
J. P. Gilliver (John)
external usenet poster
 
Posts: 5,291
Default Can I flip the order of text with a Windows program?

In message , Ken Blake
writes:
On Sun, 8 Apr 2012 12:44:38 +0100, "J. P. Gilliver (John)"
wrote:

[]
Most decent word processors can do that, but I don't think Windows
on its own
can. You might be able to write a batch file to do it.


How would you do it in Word, WordPerfect, or WordPad? My understanding

[]
I use WordPerfect X5. I just pasted

[]
into a blank document and clicked Tools|Sort. It sorted it to

[]
And I remember doing the same thing with older version of WordPerfect.

Wow; useful. I don't think Word (or WordPad) can do it!
--
J. P. Gilliver. UMRA: 1960/1985 MB++G.5AL-IS-P--Ch++(p)Ar@T0H+Sh0!:`)DNAf

"Bother," said Pooh, as Windows crashed for the umpteenth time.
  #27  
Old April 8th 12, 04:33 PM posted to alt.windows7.general
Nil[_2_]
external usenet poster
 
Posts: 2,170
Default Can I flip the order of text with a Windows program?

On 08 Apr 2012, VanguardLH wrote in
alt.windows7.general:

Metspitzer wrote:

I started a list in chronological order with older first. I
would like to switch to newest first. Most of it is a single
line. Can this be done with Windows?


Does "text" mean it is a text file where you have the lines of
strings you want to reverse their sorting order? If so, in a
command shell, run:

sort /?


That doesn't seem to do what's required here. SORT will order it in
reverse alphanumeric order, but not reverse "arbitrary" order.

I didn't know about this command. I think it's something I'll use!
  #28  
Old April 8th 12, 06:51 PM posted to alt.windows7.general
Steve Hayes[_2_]
external usenet poster
 
Posts: 1,089
Default Can I flip the order of text with a Windows program?

On Sun, 8 Apr 2012 12:44:38 +0100, "J. P. Gilliver (John)"
wrote:

In message , Steve Hayes
writes:
On Sat, 07 Apr 2012 15:47:17 -0400, Metspitzer wrote:

I started a list in chronological order with older first. I would
like to switch to newest first. Most of it is a single line. Can
this be done with Windows?


Most decent word processors can do that, but I don't think Windows on its own
can. You might be able to write a batch file to do it.


How would you do it in Word, WordPerfect, or WordPad? My understanding
is that he wants to change some text


Actually, yes, it would be difficult if he wants to reverse the
*chronological* order, rather than the alphabetical order.

As other have suggested, a spreadsheet would work best for that.

AWK might be able to do it, but I've very little understanding of it.




with lines
in it
like this

so that it looks thus

like this
in it
with lines


No, most word processors I used would change it to

in it
like this
with lines

in alphabetical order.

In Word 97

You would go to Table -- Sort
and tell it if you wanted to sort alphabetically, by number or by date, and
ascending or descending.

In Word 2010 you'd probably have to play with a bunch of ribbons to find how
to do it.

and I certainly don't know how I'd do that in any word processor I use.
(I'd probably use the suggestion others have made of putting it into
Excel or another spreadsheet, adding a number column, reverse sorting on
that column, then either deleting that column before saving back or
saving back excluding that column.)


If you've got Excel, you should have Word, so see above.


--
Steve Hayes from Tshwane, South Africa
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk
  #29  
Old April 8th 12, 06:53 PM posted to alt.windows7.general
Steve Hayes[_2_]
external usenet poster
 
Posts: 1,089
Default Can I flip the order of text with a Windows program?

On Sun, 8 Apr 2012 16:33:15 +0100, "J. P. Gilliver (John)"
wrote:

In message , Ken Blake
writes:
On Sun, 8 Apr 2012 12:44:38 +0100, "J. P. Gilliver (John)"
wrote:

[]
Most decent word processors can do that, but I don't think Windows
on its own
can. You might be able to write a batch file to do it.


How would you do it in Word, WordPerfect, or WordPad? My understanding

[]
I use WordPerfect X5. I just pasted

[]
into a blank document and clicked Tools|Sort. It sorted it to

[]
And I remember doing the same thing with older version of WordPerfect.

Wow; useful. I don't think Word (or WordPad) can do it!


Word does it, as described in earlier message. Table -- Sort

Yes, putting it under Table instead of Tools was silly, which is perhaps why
you didn't know where to find it, and they've probably put it somewhere even
sillier in the latest version.


--
Steve Hayes from Tshwane, South Africa
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk
  #30  
Old April 8th 12, 06:56 PM posted to alt.windows7.general
Steve Hayes[_2_]
external usenet poster
 
Posts: 1,089
Default Can I flip the order of text with a Windows program?

On Sun, 08 Apr 2012 11:33:33 -0400, Nil
wrote:

On 08 Apr 2012, VanguardLH wrote in
alt.windows7.general:


sort /?


That doesn't seem to do what's required here. SORT will order it in
reverse alphanumeric order, but not reverse "arbitrary" order.

I didn't know about this command. I think it's something I'll use!


It can do quite a lot --- this is what you get when you type it.


SORT [/R] [/+n] [/M kilobytes] [/L locale] [/REC recordbytes]

[[drive1:][path1]filename1] [/T [drive2:][path2]]

[/O [drive3:][path3]filename3]

/+n Specifies the character number, n, to

begin each comparison. /+3 indicates that

each comparison should begin at the 3rd

character in each line. Lines with fewer

than n characters collate before other lines.

By default comparisons start at the first

character in each line.

/L[OCALE] locale Overrides the system default locale with

the specified one. The ""C"" locale yields

the fastest collating sequence and is

currently the only alternative. The sort

is always case insensitive.

/M[EMORY] kilobytes Specifies amount of main memory to use for

the sort, in kilobytes. The memory size is

always constrained to be a minimum of 160

kilobytes. If the memory size is specified

the exact amount will be used for the sort,

regardless of how much main memory is

available.



The best performance is usually achieved by

not specifying a memory size. By default the

sort will be done with one pass (no temporary

file) if it fits in the default maximum

memory size, otherwise the sort will be done

in two passes (with the partially sorted data

being stored in a temporary file) such that

the amounts of memory used for both the sort

and merge passes are equal. The default

maximum memory size is 90% of available main

memory if both the input and output are

files, and 45% of main memory otherwise.

/REC[ORD_MAXIMUM] characters Specifies the maximum number of characters

in a record (default 4096, maximum 65535).

/R[EVERSE] Reverses the sort order; that is,

sorts Z to A, then 9 to 0.

[drive1:][path1]filename1 Specifies the file to be sorted. If not

specified, the standard input is sorted.

Specifying the input file is faster than

redirecting the same file as standard input.

/T[EMPORARY]

[drive2:][path2] Specifies the path of the directory to hold

the sort's working storage, in case the data

does not fit in main memory. The default is

to use the system temporary directory.

/O[UTPUT]

[drive3:][path3]filename3 Specifies the file where the sorted input is

to be stored. If not specified, the data is

written to the standard output. Specifying

the output file is faster than redirecting

standard output to the same file.



--
Steve Hayes from Tshwane, South Africa
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 08:32 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.