sync: 2026-11-24 17:20
This commit is contained in:
1 parent
caba0aaa89
commit
cc37492b1b
4 files changed
+48
-1
No files matched your search
+1
-1
Submodule DEV1.1/TP updated: c131b8f5d0...73b0bc12f0.
Executable
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ $# -lt 3 ]]; then
|
||||||
|
echo "Usage: $0: <STRINGS_REPRESENTATION_FILE> <radix> <REPORTS_FILE>"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $2 -lt 2 || $2 -gt 36 ]]; then
|
||||||
|
echo "radix should be between 2 and 36 !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f $3 ]]; then
|
||||||
|
read -p "reports file exists you want to overwrite it (Y/n) " choice
|
||||||
|
if [[ choice == "N" ]]; then
|
||||||
|
echo "user don't want to overwrite the report file exiting.."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp /dev/null $3
|
||||||
|
fi
|
||||||
|
|
||||||
|
DIGITS=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||||
|
|
||||||
|
LEGAL_DIGITS=$(expr substr $DIGITS 1 $2)
|
||||||
|
|
||||||
|
while read line; do
|
||||||
|
report=""
|
||||||
|
l=$(expr length $line)
|
||||||
|
for ((i = 1; i <= l; i++)); do
|
||||||
|
digit=$(expr substr $line $i 1)
|
||||||
|
pos=$(expr index $LEGAL_DIGITS $digit)
|
||||||
|
if [[ pos -eq 0 ]]; then
|
||||||
|
report=$report$digit
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "$line : $report"
|
||||||
|
|
||||||
|
done <$1 >>$3
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
101
|
||||||
|
1011011
|
||||||
|
12010
|
||||||
|
11011201040
|
||||||
|
24A5204
|
||||||
|
15E12A122G84K48
|
||||||
|
493B6H
|
||||||
|
789810924
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
101
|
||||||
Reference in new issue
Block a user