92,875 reputation
12105226
bio website
location European Union
age
visits member for 2 years, 2 months
seen 24 mins ago

Sep
18
comment Numeric sort by the column values
@Guforu, sort's default column delimiter is the transition between a non-blank and a blank. So -k16n numerically sorts on the part of the line that goes from the 15th occurrence of that to the end of the line. For instance, in a line like " a b, 1 d, 2 e", -k3n would consider " 1 d, 2 e" as the sort key. Because of n, that's treated as 1, so -k3n is the same as -bk3,3n.
Sep
18
revised Numeric sort by the column values
added 11 characters in body
Sep
18
answered Numeric sort by the column values
Sep
18
comment Numeric sort by the column values
Just sort -n. There's no 16th column in that output of awk
Sep
18
answered Output piped content to file and show number of lines in the file on stdout
Sep
18
comment bash how to remove options from parameters after processing
Yes, though (($#)) is more a kshism.
Sep
18
revised bash how to remove options from parameters after processing
added 840 characters in body
Sep
18
revised bash how to remove options from parameters after processing
added 42 characters in body
Sep
18
answered bash how to remove options from parameters after processing
Sep
18
comment Can I specify a redirected input before a compound command?
@kasperd, yes, that's how ash works. It does nor fork except when necessary, but forking has side effects (co-holds file descriptors for instance) as well and possible security implications. While the temp file is something that is proven as it has been used for over 35 years (note that the temp file is deleted before being filled up). It also has the benefit of being seekable. There's good and less good in both approaches.
Sep
18
comment Can I specify a redirected input before a compound command?
@kasperd, that should be a separate question, but a pipe involves forking an additional process to feed the other end so is generally less efficient. Having said that, rc/es and ash use a pipe there, though they are in minority (ash doesn't fork an additional process unless the content doesn't fit in the pipe buffer though)
Sep
18
awarded  Nice Answer
Sep
18
revised Can I specify a redirected input before a compound command?
deleted 4 characters in body
Sep
18
comment Is it possible to use `find -exec sh -c` safely?
@BroSlow, I couldn't agree less. It's not a placeholder. People need to know that's to set $0, and using _ would deceive them into thinking it's a placeholder. And I can't see what's intuitive about _ (it's even more cumbersome to type than sh on my British keyboard). If you want something shorter, use .. At least that suggests the . (source) command which would be slightly more appropriate for $0.
Sep
18
awarded  Enlightened
Sep
18
awarded  Nice Answer
Sep
17
revised Solving “mv: Argument list too long”?
prefer the more reliable, shorter and portable -0 over -d '\n' (-d was after mv btw).
Sep
17
comment zsh solutions to “the argument list is too long”
that also recurses in the sub-directories which was not asked for.
Sep
17
revised zsh solutions to “the argument list is too long”
edited body
Sep
17
comment zsh solutions to “the argument list is too long”
That will also break on file names that contain spacing or quoting characters.