vindarel / lisp-journey

Discovering the Common Lisp ecosystem. https://lisp-journey.gitlab.io/
2 stars 0 forks source link

blog/snippet-manipulating-rows-and-columns-with-clawk/ #10

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

Snippet: Manipulating Rows and Columns With ClAWK - Lisp journey

I just discovered clawk, that seems to originate from lispbuilder-clawk. Its last commit dates from 2011, typical from Lisp and that's OK, libraries have the right to be done, it has no useful README nor documentation, but we can see its use in the tests, and the library is easily discoverable.This library seems perfect to manipulate data in rows and columns.Let's have a quick look with this dummy txt file:

https://lisp-journey.gitlab.io/blog/snippet-manipulating-rows-and-columns-with-clawk/

vindarel commented 4 years ago

Thank you myself :) I wanted to invert 2 columns in a text file so I went with this snippet in no time, without the burden to check the AWK syntax:

(for-file-lines ("file.txt")
    (with-fields ((a b))
       ($print b a)))