csvGrep

command module
v0.0.0-...-c2c75d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2021 License: Unlicense Imports: 11 Imported by: 0

README

csvGrep

grep like util for csv

Getting Started

Build the executable with go build.

./csvGrep --help will give you this:

Usage of ./csvGrep:
  -C value
        list of columns to operate on by name
  -c value
        list of columns to operate on
  -e string
        regex pattern to match
  -f string
        path to input file instead of stdin
  -s string
        separator character (defaults to a comma) (default ",")
  -v    invert (like -v in grep) return only the rows that *don't* fulfill the pattern

Example

  • Find bad strings (????? instead of names) in the customers file:
./csvGrep -e="[?]{4,}" -f="./customers.csv"
  • Search in specific column
head -n1 customers.csv 
id,firstName,lastName,userId,email,phone,countryId,status,registrationDate,campaignId,balance,isLead

head -n1 customers.csv | ./csvGrep -e="Name" -c=2
id,firstName,lastName,userId,email,phone,countryId,status,registrationDate,campaignId,balance,isLead

head -n1 customers.csv | csvGrep -e="Name" -c=0
  • Find gmail customers in the first 10 rows:
 head -n10 customers.csv | csvGrep -C="email" -e="gmail"

Built With

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL