field: a small command to print fields from stdin

Something I do a lot is stuff like this: ls -l | awk ‘{print $5″\t”$6}’

Usually… I just want to some subset of the output delimited on whitespace… I might use cut, but cut doesn’t work well if the whitespace varies… For example if is some combination of tabs and spaces.

So I use awk… even the syntax is sort of a nuisance if you are doing something so trivial…. So I recently wrote field.

It is a very small program with usage like: ls -l | field 5 6

Feel free to use it if you like.

It has no warranty, so don’t expect your money back if it piddles on the new rug…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: