coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add option to `cut` to avoid empty fields when using -d


From: Shriramana Sharma
Subject: Add option to `cut` to avoid empty fields when using -d
Date: Sun, 18 Oct 2015 08:36:55 +0530

Hello. I often try to use `cut` to get specific columns from `ls -l`
but since `ls` uses spaces as padding for aligning fields, I am not
able to do something like this to get the sizes alone (just for
illustration):

$ ls -l
total 1632
-rwxrwxr-x 1 samjnaa samjnaa  548912 Oct 18 08:20 add-commas
-rw-rw-r-- 1 samjnaa samjnaa     752 Oct 17 15:32 add-commas.d
-rw-rw-r-- 1 samjnaa samjnaa 1109848 Oct 18 08:20 add-commas.o
-rw-rw-r-- 1 samjnaa samjnaa     413 Oct 18 08:19 compile
$ ls -l | cut -d ' ' -f5



1109848

$

I request that an option may be added to collapse multiple consecutive
instances of the same delimiter to avoid empty fields in the output in
use cases such as above.

Thanks!

-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा



reply via email to

[Prev in Thread] Current Thread [Next in Thread]