You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/09/14 00:56:47 UTC
DO NOT REPLY [Bug 40504] New: - Provide sort task like UNIX sort function
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
Summary: Provide sort task like UNIX sort function
Product: Ant
Version: 1.6.5
Platform: Other
OS/Version: other
Status: NEW
Severity: enhancement
Priority: P2
Component: Core tasks
AssignedTo: dev@ant.apache.org
ReportedBy: achepati67@yahoo.es
Just to suggest to add the sort function like the UNIX sort function which is
very powerfull.
Thanks in advance,
David
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
------- Additional Comments From achepati67@yahoo.es 2006-10-01 14:24 -------
Created an attachment (id=18948)
--> (http://issues.apache.org/bugzilla/attachment.cgi?id=18948&action=view)
SortFilter class, testing class and testing framework
I have included a patch for adding a new filter SortFilter class. I have
considered the following features on it:
- Sort lines of the file in ascendant order.
- Sort lines in descendant order.
- Sort file using a Comparator class for user configurated sorting criterium.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
------- Additional Comments From achepati67@yahoo.es 2006-10-01 14:50 -------
Antoine,
Please let me know if this patch (SortFilter) will be incorporated in a future
Ant Release. Thanks. David
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
------- Additional Comments From achepati67@yahoo.es 2006-10-01 14:47 -------
Dear Antoine and others,
Following your recomendation I have added a patch with an implementation of
SortFilter, it implements ChainableReader, because I think it have to, but I
am not sure.
Because the UNIX sort function, has a lot of different possibilities, such
amount of possible options from Java point of view can be only considered
alowing the user just to define a Comparator implementation. That is my
approach in general for this features, except for common criterias such us:
Reverse order, considered via reverse parameter.
This approach allow in a future multiple extension points adding new
parameters.
Note: I didn't implement the test of invoking recursively two or more sorting
criteria at the same time (That is why I guess it has to implement
ChainableReader). I guess it is easy to implement this test, invoking ant like
this:
<target name="testSortFilterTwo" depends="init">
<copy file="input/sort.sortDefault.test"
tofile="result/sort.sortDefault.test">
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.SortFilter">
<param name="reverse" value="true"/>
</filterreader>
<filterreader classname="org.apache.tools.ant.filters.SortFilter">
</filterreader>
</filterchain>
</copy>
</target>
the result has to be the same as testSortFilterNoArgs test case.
On the patch I have respected the same directory structure as in the SVN:
http://svn.apache.org/repos/asf/ant/core/trunk/src/
Regards,
David
P.S.: I am going to implement now a similar filter for diff command (I need
both of them on my project), my idea is:
<filterchain>
<diff reference="referenceFile.txt"/>
</filterchain>
It can be implemented in a similar way as <concat> Ant Task, nevertheless via
filter is also a good solution for that. I am going to add a new patch for
that (when I done it)
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
------- Additional Comments From gudnabrsam@yahoo.com 2006-10-01 08:26 -------
Additionally you can write all the custom ResourceComparators you like and use
them with a <sort> collection of <tokens> in Ant 1.7 . All it takes is a
little imagination!
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
gudnabrsam@yahoo.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
------- Additional Comments From gudnabrsam@yahoo.com 2006-09-14 14:02 -------
of interest, with Ant 1.7 you could use <string> resources in a <sort>
collection and sort strings, then push the sorted list to a file with
<pathconvert> and <echo>. The only thing missing is an easy way to create
<string> resources to begin with. Example:
<project>
<pathconvert pathsep="${line.separator}">
<sort>
<resources>
<string value="foo" />
<string value="bar" />
<string value="baz" />
<string value="etc" />
</resources>
</sort>
</pathconvert>
</project>
Yields:
Buildfile: build.xml
[pathconvert] bar
[pathconvert] baz
[pathconvert] etc
[pathconvert] foo
BUILD SUCCESSFUL
Total time: 0 seconds
:)
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
------- Additional Comments From antoine@apache.org 2006-09-14 01:28 -------
Hello David,
I would recommend to implement this not as a task but as a filter.
see http://ant.apache.org/manual/CoreTypes/filterchain.html
If you have some time you could try to write yourself the filter java
implementation and attach it to this bug report.
Regards,
Antoine
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
gudnabrsam@yahoo.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |1.7.0
------- Additional Comments From gudnabrsam@yahoo.com 2006-09-28 14:08 -------
Added a <tokens> resource collection to SVN HEAD. It's pretty cute IMHO.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
gudnabrsam@yahoo.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #18948|text/plain |application/zip
mime type| |
Attachment #18948|1 |0
is patch| |
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
------- Additional Comments From carej@us.ibm.com 2006-10-01 08:08 -------
It's unrealistic to expect Ant to provide completely identical function to a
dedicated command line utility.
If you need all of the function of sort, I would suggest that you exec it.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
DO NOT REPLY [Bug 40504] - Provide sort task like UNIX sort function
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40504
------- Additional Comments From achepati67@yahoo.es 2006-09-30 10:41 -------
Antoine,
Thanks for your suggestion, I am going to try implement it, but...if you take
a look into the UNIX sort syntax there are a lot of options:
http://www.xmission.com/~comphope/unix/usort.htm
Do you have any suggestion about how to attack the all possible input
options?, they are not only simple parameters, for example you can specify the
priority of each field or column position will be take firt on the comparation
criteria, for example:
sort -o $2 -k1.1,1.6 -k1.49,1.57 -k1.714,1.717 -k1.712,1.713 -k1.710,1.711 -
k1.694,1.694 -k1.718,1.729 $1
will sort taking first the position starting at column 1 to 6, then the string
starting at column 49 to 57. All such fields are specified from the first
column (k1*), but you can specify them via relative position of a given field
(a field can be identified by tabs or spaces for example. As you can see such
sort function is very powerfull.
Please could you give me any hint about that. I am a Ant user, but I have
never implemented any feature on Java.
Thanks,
David
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org