Skip to main content

Extact fields from a file

Project description

Name

field - extract fields from a file

SYNOPSIS

field [-h] [-f FILE] [-d DELIMITER] [field [field ...]]

DESCRIPTION

Field extracts a list of fields or columns from a file. It is a simpler version of awk '{ print $1; }'.

Default is to read whitespace (<space><tab>) delimited text from _stdin_ and write fields to _stdout_.

OPTIONS

  • -f FILE, --file FILE - Extract fields from each line of the _FILE_. Defaults to _stdin_.

  • -d DELIMITER, --delimiter DELIMITER - Single character used to distinguish between fields. Defaults to whitespace (<space><tab>).

EXAMPLE

$ mount | field 5 3 1
ext4 / /dev/mapper/sda7_crypt
proc /proc proc
sysfs /sys sysfs
$ ls -l /usr/local/bin/ | field 1 9
-rwxr-xr-x airbrake*
-rwxr-xr-x bayes.rb*
-rwxr-xr-x bourbon*
cat /etc/mtab | cut -d' ' -f 4 | field -d',' 1 4 3 2
rw gid=5 nosuid noexec
rw size=10% nosuid noexec
rw nodev nosuid noexec
rw user=root nodev nosuid

AUTHOR

Written by Trevor Bramwell.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

field-0.1.0.tar.gz (2.9 kB view hashes)

Uploaded Source

field-0.1.0.linux-x86_64.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

field-0.1.0-py2-none-any.whl (4.8 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page