GNU bug report logs - #20928
cut (v. 8.21), using -f option with a single column

Previous Next

Package: coreutils;

Reported by: "Kuchta, Tomasz" <t.kuchta12 <at> imperial.ac.uk>

Date: Mon, 29 Jun 2015 15:19:02 UTC

Severity: normal

Tags: notabug

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #24 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stephane Chazelas <stephane.chazelas <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Re: bug#20928: cut (v. 8.21), using -f option with a single column
Date: Mon, 29 Jun 2015 17:42:53 +0100
2015-06-29 17:25:11 +0100, Pádraig Brady:
[...]
> > $ printf '%s\n' a:b c d:e | paste -d: - /dev/null | cut -d: -f2
> > b
> > 
> > e
> 
> Good point. Or to better support field ranges:
> 
> $ printf '%s\n' a:b c d:e | sed 's/^[^:]*$/&:/' | cut -d: -f2-
> b
> 
> e
[...]

Maybe better as:

$ printf '%b\n' a:b 'P\0341draig' d:e | sed '/:/!s/$/:/' | cut -d: -f2-

so it also works on lines that contain invalid characters.

-- 
Stephane





This bug report was last modified 10 years and 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.