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
