Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: multibyte cutb #83

Open
roycewilliams opened this issue Dec 2, 2023 · 0 comments
Open

feature: multibyte cutb #83

roycewilliams opened this issue Dec 2, 2023 · 0 comments

Comments

@roycewilliams
Copy link
Member

roycewilliams commented Dec 2, 2023

When input is UTF-8, cutting on character count - even when it is not aligned with byte count - would be useful. This could be added to cutb as a flag, or could be a separate utility.

This script produces some of the desired behavior:

$ cat multicutb
#!/bin/bash

if [ -z "$1" -o -z "$2" ]; then
    echo "Usage: $0 [offset] [length]"
    echo "(similar to cutb from hashcat utils)"
    exit 1
fi
offset=$1
length=$2

grep -Po "^.{$offset}\K.{$length}"
$ echo Τηεοδ29 | multicutb 1 3
ηεο

(but doesn't cover the negative-offset functionality)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant