Skip to main content

New answers tagged

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 ...
Stéphane Chazelas's user avatar
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 ...
Stéphane Chazelas's user avatar
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\...
muru's user avatar
  • 77.9k
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: ~$ ...
jubilatious1's user avatar
  • 3,903
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; ...
Raffa's user avatar
  • 509
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)...
Stéphane Chazelas's user avatar
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 ...
Hauke Laging's user avatar
  • 94.5k

Top 50 recent answers are included