Coder Social home page Coder Social logo

jawk's Introduction

Jawk - ReadMe

Intro

JAWK is a pure Java distribution of AWK. It uses Maven, and comes with OSGi meta data (it only exports package(s)). Its is licensed under the GPL, and the location of the source code can be found in the project documentation site (see below), or the project file (pom.xml).

How to build

Jawk uses Maven 2+ as build system, which you have to install first. If you did so, you can:

compile & package:

mvn package

execute:

mvn exec:java

create project documentation (to be found under target/site/index.html):

mvn site

Jawk relies on BCEL for parsing AWK scripts.

Release

Prepare "target/" for the release process

mvn release:clean

Prepare the release

  • asks for the release and new snapshot versions to use (for all modules)

  • packages

  • signs with GPG

  • commits

  • tags

  • pushes to origin

      mvn release:prepare
    

Perform the release

  • checks-out the release tag

  • builds

  • deploy into Sonatype staging repository

      mvn release:perform
    

Promote it on Maven

Moves it from the Sonatype staging to the main Sonatype repo.

  1. using the Nexus staging plugin:

     mvn nexus:staging-close
     mvn nexus:staging-release
    
  2. ... alternatively, using the web-interface:

    • firefox https://oss.sonatype.org
    • login
    • got to the "Staging Repositories" tab
    • select "org.jawk..."
    • "Close" it
    • select "org.jawk..." again
    • "Release" it

jawk's People

Contributors

eyalroth avatar hoijui avatar jannick0 avatar paulkrause88 avatar stonewell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jawk's Issues

compile error if (escaped) slash in regular expression

Hi,

very interesting project this is! Testing around I bumped into a jawk compilation issue when invoking a regular expression in a pattern containing a slash.

/\// { print }

While being complete newbie to the whole java world for a couple of days now, this error occured both with jawk.1_02.jar (which might be a bit outdated right now) and the compiled master branch as of now. Not sure if this is a bug or rather some error here on my side. Any help on that highly appreciated.

Separately, for compiling the master branch I needed to make two adjustments:

  1. Suppressing tests since three tests failed.
  2. Inserting an empty <relativePath></relativePath> element to <parent>...</parent> to avoid that some other stuff is used.

Happy to provide any more information if needed or running tests.

Thx!

AwkScript.class in default package cannot be used from other Java class

Java cannot use default package classes from classes in other packages. This makes the solution pretty unflexible. Maybe you can add an option to specify another package for the class to be compiled and even provide a default such as org.jawk.

Meanwhile, can I somehow compile and then use a script on the fly, assuming that a compiled script executes faster than an interpreted one?

Thanks in advance and sorry for the possibly naive question, but the documentation is kinda brief.

Enhancement: Allow Jawk to print to an arbitrary OutputStream

When not printing to a file, AVM.interpret() will print to System.out. One may need to print to something else (Socket, ByteArrayOutputStream, etc.).

Add an option in the AwkSettings class to set the output stream.

The same probably needs to be done for compilation.

Artifact availability in a public Maven repository

Hello,

Please, is Jawk available in any public Maven repository (like Nexus for example)?
The readme file does mention Nexus, which makes me think it should be available there. However, when I search it, I don't find it.

Or are you expecting users to always build, store and manage Jawk artifacts on their own?

Thanks.

Setting output file

Hello- I've started using jawk as a library within a Java program. Thanks for making it available.

What I'm trying to do should be pretty standard: Read a file as InputStream, parse it through jawk, collect the output from jawk. The problem is that the output of jawk seems to go to stdout instead of to the file I set.

This is what I'm doing:

@Test
public void testAwk() throws Exception{

    InputStream is= new FileInputStream("test_data/hg19_genes_head.gtf"); // File to parse

    String[] args= {"-F", "\t", "NR < 10"}; // Trivial awk script

    AwkParameters parameters = new AwkParameters(Main.class, null);
    AwkSettings settings = parameters.parseCommandLineArguments(args);

    settings.setInput(is); 
    settings.setOutputFilename("/tmp/foo.txt"); // Here is where I expect the output to go.

    Awk awk= new Awk();
    awk.invoke(settings);
}

When I execute testAwk() I see the first ten lines of the input file printed to stdout and the supposed output file "/tmp/foo.txt" is not even created.

I also tried setting the output file in the awk script: String[] args= {"-o", "/tmp/foo.txt", "-F", "\t", "NR < 10"} and I got the same result.

In either case the output of settings.getOutputFilename(null) is "/tmp/foo.txt".

What am I doing wrong? And more in general, is the above the recommended strategy to use jawk as a library in a Java program?

Many thanks!

Dario

compile version [-Z] throws error from getline

The simple awk script

/a/ { print "ahh" }

is well processed in the direct mode:

java -jar jawk-1.03-SNAPSHOT-stand-alone.jar -f Simple.awk input.txt

while for the compile version (-Z switch)

java -jar jawk-1.03-SNAPSHOT-stand-alone.jar -Z -f Simple.awk input.txt

throws an error. Effectively it confesses that it is a severe error.

I am not sure if this is going back to an incompatible number of arguments of the procedure org.jawk.jrt.JRT.jrtConsumeInput, but I might be completely wrong here. I checked that standalone BEGINand END blocks run through without any problem in compile mode. So rules reading from input appear to cause the issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.