Skip to content
/ pq Public

A tool to transform unstructured text to csv by regular expression

Notifications You must be signed in to change notification settings

tenmax/pq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pq

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

Sample

If input is (test.txt)

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

Issue this command

pq -R 'test=(?<test>[a-zA-z]*)&foo=(?<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

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

Download

Please download the binary from the release tag.

Install by Homebrew in Mac

brew update
brew untap tenmax/azure
brew tap tenmax/azure
brew install pq

Reference

This tool is powered by poppy

About

A tool to transform unstructured text to csv by regular expression

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages