Skip to main content

Extact fields from a file

Project description


field - extract fields from a file


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


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_.


  • -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>).


$ 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


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.

Files for field, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size field-0.1.0.linux-x86_64.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View hashes
Filename, size field-0.1.0-py2-none-any.whl (4.8 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size field-0.1.0.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page