An open API service indexing awesome lists of open source software.

https://github.com/tenmax/pq

A tool to transform unstructured text to csv by regular expression
https://github.com/tenmax/pq

Last synced: about 1 year ago
JSON representation

A tool to transform unstructured text to csv by regular expression

Awesome Lists containing this project

README

          

# pq

A tool to transform unstructured text to csv by regular expression.

# Sample

If input is (test.txt)

```html
test=abc&foo=bar1
test=def&foo=bar2
test=efg&foo=bar3
```

Issue this command

```bash
pq -R 'test=(?[a-zA-z]*)&foo=(?[a-zA-z]*)' -c test,foo test.txt
```

then output will be

```
abc,bar
def,bar
efg,bar
```

In the regular expression, we define two groups 'test', 'foo'. And we translate the group to csv columns.

# Usage

```bash
usage: pq -R -c [ ...]
-c column list. Separated by comma
-g group by list. Separated by comma
-H with CSV header
-P level of parallelism
-R the regular expression with groups
```

# Download

Please download the binary from the [release](https://github.com/tenmax/pq/releases) tag.

## Install by Homebrew in Mac
```bash
brew update
brew untap tenmax/azure
brew tap tenmax/azure
brew install pq
```

# Reference

This tool is powered by [poppy](http://tenmax.github.io/poppy/)