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
- Host: GitHub
- URL: https://github.com/tenmax/pq
- Owner: tenmax
- Created: 2016-08-12T05:16:42.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-14T00:30:54.000Z (over 7 years ago)
- Last Synced: 2025-03-26T00:51:22.356Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 56.6 KB
- Stars: 30
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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/)