Hi, I strongly feel that the text processing capabilities with java / groovy power at the command line will definitely be a great feature to the groovy language itself.
Hence my below proposal. If it is felt that the proposal is not going to add value to groovy platform, I will be happy to just delete/move this topic away from the active list... Thanks, K Adithyan India adithyank wrote > As suggested by Jochen Theodorou in this > < > http://groovy.329449.n5.nabble.com/New-DSLs-in-the-groovy-platform-itself-for-more-script-like-use-cases-td5750522.html > > > post, I have created this topic for `Text / String processing` > I have always felt that groovy platform itself can have rich set of DSLs > (list given below) so that groovy will be in hands of many non-developers. > > Also, the command line String/text processing capabilities can be greatly > enhanced with java/groovy power. * > Use Case 1 : command line usage Simple input processing can be done in the > command line itself * > > Below example adds all the numbers available as lines in the piped file. > Just a simple example for illustration... * > $ cat lines.txt | groovy -n --complex 'def s = 0; EACHLINE > {s+=line.numval}; END {println s}' * > * > Use Case 2 : DSL Script for more complex line processing functionalities > (similar to 'awk') with java / groovy power * > > def s = .... > ...... > ...... > > //for choosing lines with regex > matches (regex) { > work for those lines > } > > > //for choosing lines with some expression > matches { > > condition {expression for line selection} > > process { > work for those lines > } > } > > END { > //end closure after processing all matching lines of the input files > } -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html