Skip to main content

# Xcut Xcut is an Enhanced cut command, which is used to help grep column.

[![](https://img.shields.io/pypi/pyversions/xcut.svg?longCache=True)](https://pypi.org/pypi/xcut/) [![](https://img.shields.io/pypi/v/xcut.svg?maxAge=36000)](https://pypi.org/pypi/xcut/) [![Build Status](https://travis-ci.org/ahuigo/xcut.svg?branch=master)](https://travis-ci.org/ahuigo/xcut)

## Install

pip install xcut pip3 install xcut

xcut –help

## Usage Let’s test a file named test.csv

> ~ cat test/test.csv name,gender,job Jack,male,coder Lucy,female,artist

Cut fields

> ~ xcut -f job,name test/test.csv job,name coder,Jack artist,Lucy

### Set title type The default title type is head: -t head

> ~ xcut -f name,gender test/test.csv

Set title type to index: -t index

> ~ xcut -f 1,3 -t index test/test.csv 1,3 name,job Jack,coder Lucy,artist

Set title type to custom(–titles TITLES)

> ~ xcut -f ‘职业,姓名’ –titles ‘姓名,性别,职业’ test/test.csv -od $’t’ 职业 姓名 job name coder Jack artist Lucy

Set title type to kv(-t kv)

> ~ echo ‘key1=v1,key2=v2,key3=v3’ | xcut -f key3,key2 -t kv key3,key2 v3,v2

### Set input delimiter(d)

> ~ xcut -f job,name test/test.csv -d ‘,’ -od ‘`’ job`name coder`Jack artist`Lucy

### Set output delimiter(od)

> ~ xcut -f job,name test/test.csv -od ‘`’ job`name coder`Jack artist`Lucy

### pretty output You could set the output delimiter(od), also you can print it via pretty

> ~ xcut -f ‘职业,姓名’ –titles ‘姓名,性别,职业’ test/test.csv -od $’tt’ –pretty 职业 姓名 —————————————- job name coder Jack artist Lucy

### Use csv format Not only you could parse csv format file with –from-csv:

$ echo ‘Lucy,”98,99”,23’ | python xcut -f scores,name –titles name,scores,age scores,name “98,Lucy

$ echo ‘Lucy,”98,99”,23’ | python xcut -f scores,name –titles name,scores,age –from-csv scores,name 98,99,Lucy

You could also save the output to csv format with(–to-csv)

$ echo ‘Lucy,”98,99”,23’ | python xcut -f scores,name –titles name,scores,age –from-csv –to-csv scores,name “98,99”,Lucy

## Required 1. python>=3.5 2. click

Metadata

Release files for xcut 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xcut 0.0.11
File Size Uploaded Provenance Actions
xcut-0.0.11.tar.gz 3.8 kB Without provenance Details for xcut-0.0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xcut 0.0.11
File Interpreter ABI Platform Actions
xcut-0.0.11-py3-none-any.whl Python 3 none any Details for xcut-0.0.11-py3-none-any.whl

Total release size: 7.5 kB

Release files / xcut-0.0.11.tar.gz

Download URL xcut-0.0.11.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c57132ee7fade8d389a769083690839b0ca3fba75a07d517b0f01211352a5878
BLAKE2b-256 checksum
How to use checksums
cc7fa42aca48863c831bb456af02006a97c10e3356d9b8d6710b0d41fc3dc6a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release files / xcut-0.0.11-py3-none-any.whl

Download URL xcut-0.0.11-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba4ecb33c04632fa6ea0a9a6de32f39631bbace1e3c4844c834173cb2b495e5d
BLAKE2b-256 checksum
How to use checksums
82144a8c602525a8974a09a4dec72d480b7668f7670b7fc400ece2d0e058a1b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Security for xcut 0.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page