New answers tagged filenames
0
votes
Get Character Code for Character in File Name
Most shells have a completion mode in which you can cycle through completions.
For instance with zsh and complist enabled:
Above, pressing Tab and navigating with arrow keys.
That allows you to ...
1
vote
Get Character Code for Character in File Name
To get the Unicode code point for characters other than the graphical ASCII ones (U+0021 (!) to U+007E (~); that is ASCII characters other than space and control ones), you could pipe the output of ...
3
votes
Accepted
Get Character Code for Character in File Name
If you have a recent enough coreutils, you can use ls with the C locale:
% export LC_ALL=C.UTF-8
% ls -b
foo bar
% export LC_ALL=C
% ls -b
foo\343\200\200bar
% ls --quoting-style=c
"foo\343\200\...
2
votes
How can I find common prefixes in file names to group them?
Using Raku (formerly known as Perl_6)
Raku regex below groups filenames by starting characters: minimum 3-or-more <alpha> characters followed by \h horizontal whitespace or _ underscore:
~$ ...
0
votes
How can I find common prefixes in file names to group them?
In pure bash, a function with either pattern globbing like:
myfind ()
{
( shopt -s nullglob;
printf '%s\n' "$1"* )
}
or RegEx matching like:
myfind ()
{
( shopt -s nullglob;
...
9
votes
How can I find common prefixes in file names to group them?
With perl:
$ find . -print0 | perl -C -l -0ne '
if (m{/([^/]{4,}?\w)\b[^/]*\z}) {
push @{$list{$1}}, $_;
}
END {
while (($part, $list) = each(%list)) {
if (($count = @$list) > 1)...
3
votes
How can I find common prefixes in file names to group them?
If you only accept the string to end at a word border then this gives you the potential common strings; tune that to your requirements:
sed -n '/^\(\w\+ \w\+\) /s/^\(\w\+ \w\+\) .*$/\1/p' file
Then ...
Top 50 recent answers are included
Related Tags
filenames × 1228bash × 246
shell × 173
rename × 158
shell-script × 146
files × 129
linux × 123
find × 117
directory × 85
command-line × 66
wildcards × 63
filesystems × 51
quoting × 50
ls × 40
text-processing × 38
rm × 38
grep × 36
sed × 35
sort × 34
awk × 31
scripting × 29
regular-expression × 29
symlink × 27
string × 24
cp × 24