Reputation
Next tag badge:
1014/1000 score
195/200 answers
Badges
21 207 385
Impact
~7.2m people reached

2h
comment How to escape shell metacharacters automatically with `find` command?
@schily, you're being confused, there's no shell globbing here.
2h
comment How to escape shell metacharacters automatically with `find` command?
@schily, set -f is irrelevant here. There's no shell globbing in the OP's question. The problem here is the fnmatching performed by find -name when we would like it to do a byte-to-byte comparison, and set -f won't affect find's behaviour.
16h
comment How to escape shell metacharacters automatically with `find` command?
I think you're missing the point of the question here. The OP is calling find within find with the argument to the -name of the second find being provided by the first find and transformed by a shell.
21h
comment How to escape shell metacharacters automatically with `find` command?
Yes, that's the problem, you only want to escape [, * and ? while printf %q will escape others, like it will change a newline character to $'\n' which for find -name is $'n'.
22h
comment How to escape shell metacharacters automatically with `find` command?
printf '%q' will not escape all characters in the proper way for find's -name. Like for control characters or some non-ascii characters.
1d
comment How can I get relative date based on relative date by linux date command?
@Dani_l, depends how you look at it. At the time that command outputs a date, the date displayed would be the last monday relative to 10m earlier.
1d
comment How can I get relative date based on relative date by linux date command?
ITYM GNU date instead of linux date. linux is just an OS kernel software. There are several date implementations that can be compiled for Linux, the most common on non-embedded OSes that use Linux as their kernel is the one from the GNU project (part of GNU coreutils).
1d
comment Can sed replace new line characters?
You might want to read Why is using a shell loop to process text considered bad practice? and Security implications of forgetting to quote a variable in bash/POSIX shells and maybe Why is printf better than echo?
1d
comment Can sed replace new line characters?
Note that that syntax is GNU specific, and even with GNU sed, if POSIXLY_CORRECT is in the environment and the input has only one line, there will be no output.
1d
comment Can sed replace new line characters?
Note that that syntax is GNU specific, and even with GNU sed, if POSIXLY_CORRECT is in the environment and the input has only one line, there will be no output.
2d
comment Can sed replace new line characters?
But runs the s command for each input line on a pattern space that is increasingly big.
2d
comment Sort files by highest number in filename
For non-GNU seds, or if POSIXLY_CORRECT is in the environment, you'll need to replace N with $!N.
2d
comment Sort files by highest number in filename
It won't work if there's a ab-1.txt and b-2.txt, you'll want to anchor your pattern (/^\(...txt$/)
2d
comment Sort files by highest number in filename
Note that -t, -v, \+ are GNU-specific extensions.
2d
comment Sort files by highest number in filename
You'll also have problems with filenames starting with - here. Or if some of those files are of type directory (or symlink to directory). ls -vd -- ...
2d
comment Sort files by highest number in filename
Remember the problem with unquoted expansions is not only above spaces, it's about any $IFS character and glob wildcards.
2d
comment How to handle sub-command line in shell script?
link on how to use gattool non-interactively
2d
comment Retrieve string between two strings
Or grep -Po 'midoc-\K\d+'
Feb
11
comment Remove file name when recursively counting number of occurrences of a pattern
Do you want one number per line for each file without knowing which file that number correspond to? Or just one number for the number of occurrences in all the files?
Feb
11
comment Replace composed unicode characters
@MatthewRock, would uconv -x '::nfkc;[:Nonspacing Mark:]>;' work for you? (drop accents after canonical composition, so that characters that don't have a pre-composed form have their accent shaved of)