Your Ad Here

Sabtu, 31 Agustus 2013

Unix Tip: CUT FROM STANDARD COMMANDS

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3491 - August 31, 2013

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


CUT FROM STANDARD COMMANDS

To properly cut the output of
unix standard commands; such
as ls, ps; and properly handle
them without all the extra
spaces, use this:

% ls -lt| tr -s " " | cut -f6-10
% ls -lt| tr -s " " | < --do what ever-- >

tr -s " " ==> here tr in
effect removes all the extra
formatting extra spaces
introduced by unix shell,
for display, and translates
in to format easy to work
with.

If we dont use this tr, then
the -c option of cut will be
unreliable because of varying
size field lengths in the
output and also -f option
will be unreliable because of
extra formatting delimiters.

ls -lt | tr -s " "
ps -ef | tr -s " "

gives us proper output to
properly extract data or
columns.

This tip generously supported by: snlmurthy@yahoo.com


--------------------------------------------------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2001
==========================================================================

Tidak ada komentar:

Posting Komentar

Your Ad Here
Free Automatic Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink