78,236 reputation
1082186
bio website
location European Union
age
visits member for 1 year, 11 months
seen 39 mins ago

Jun
24
revised Print a multiline variable in a column
added 31 characters in body
Jun
24
revised Print a multiline variable in a column
added 193 characters in body
Jun
24
comment List directories with dot directories last, then dot files
@llua, yes, but since we're executing a command anyway, we might as well limit the scope with a subshell (note the ( instead of {)
Jun
23
revised List directories with dot directories last, then dot files
added 90 characters in body
Jun
23
revised List directories with dot directories last, then dot files
added 238 characters in body
Jun
23
answered List directories with dot directories last, then dot files
Jun
23
answered Print a multiline variable in a column
Jun
23
comment Shortest way to extract last 3 characters of base (minus suffix) filename
@mikeserv, I didn't mean to imply expr was not POSIX. It certainly is. It's rarely built-in though.
Jun
23
revised Shortest way to extract last 3 characters of base (minus suffix) filename
missing quotes and --
Jun
23
revised Shortest way to extract last 3 characters of base (minus suffix) filename
added 81 characters in body
Jun
23
comment Shortest way to extract last 3 characters of base (minus suffix) filename
@mikerserv, yours is POSIX, uses builtins only and doesn't fork any process. Not using command substitution also means you avoid problems with trailing newlines, so it's a good answer too.
Jun
23
comment Shortest way to extract last 3 characters of base (minus suffix) filename
yes. It's ${var#$pattern} or ${var#"$string"}. Same goes for case $x in $pattern) "$string") or [[ $x = $pattern ]]/[[ $x = "$string" ]] in ksh or bash.
Jun
23
revised Shortest way to extract last 3 characters of base (minus suffix) filename
added 157 characters in body
Jun
23
answered Shortest way to extract last 3 characters of base (minus suffix) filename
Jun
23
comment Shortest way to extract last 3 characters of base (minus suffix) filename
The quotes in lastpart=${noextn#"${noextn%???}"} are not about IFS, it's to prevent ${noextn%???} from being taken as a pattern.
Jun
23
revised Shortest way to extract last 3 characters of base (minus suffix) filename
you need to disable globbing if you only want the split part of the split+glob operator.
Jun
23
comment Cannot sum numbers received from stdin using bc
Use paste -sd'\0' - instead of tr -d '\n' to preserve the last newline character. (see also paste -sd+ - to join lines with +).
Jun
23
comment How to copy contents of command line search result in unix to a file?
@Boogy, not sure what you mean. dump.test is open only once and that is made the standard output of xargs in the first one and find in the second. So all the output of those and their children will be included in there, there will not be any erasing/overwriting.
Jun
23
revised How to copy contents of command line search result in unix to a file?
added 200 characters in body
Jun
23
comment How to copy contents of command line search result in unix to a file?
@user73352, as I said, that's for GNU grep and xargs. That won't work with other implementations of grep or xargs.