Skip to content

Commit

Permalink
Sort hash by filename
Browse files Browse the repository at this point in the history
  • Loading branch information
cfgnunes committed May 3, 2024
1 parent f670510 commit b98cd2b
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Hash and checksum/List CRC32
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ _main() {
local std_output=""
std_output=$(_storage_text_read_all)
std_output=$(_text_sort "$std_output")
# shellcheck disable=SC2001
std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_display_list_box "$std_output" "--column=CRC32;--column=File"
}
Expand All @@ -41,7 +43,7 @@ _main_task() {
fi

# shellcheck disable=SC2001
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\1$FIELD_SEPARATOR\2|g" <<<"$std_output")
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_storage_text_write_ln "$std_output"
}
Expand Down
4 changes: 3 additions & 1 deletion Hash and checksum/List MD5
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ _main() {
local std_output=""
std_output=$(_storage_text_read_all)
std_output=$(_text_sort "$std_output")
# shellcheck disable=SC2001
std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_display_list_box "$std_output" "--column=MD5;--column=File"
}
Expand All @@ -34,7 +36,7 @@ _main_task() {
std_output=$(_text_remove_pwd "$std_output")

# shellcheck disable=SC2001
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\1$FIELD_SEPARATOR\2|g" <<<"$std_output")
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_storage_text_write_ln "$std_output"
}
Expand Down
4 changes: 3 additions & 1 deletion Hash and checksum/List SHA-1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ _main() {
local std_output=""
std_output=$(_storage_text_read_all)
std_output=$(_text_sort "$std_output")
# shellcheck disable=SC2001
std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_display_list_box "$std_output" "--column=SHA-1;--column=File"
}
Expand All @@ -34,7 +36,7 @@ _main_task() {
std_output=$(_text_remove_pwd "$std_output")

# shellcheck disable=SC2001
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\1$FIELD_SEPARATOR\2|g" <<<"$std_output")
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_storage_text_write_ln "$std_output"
}
Expand Down
4 changes: 3 additions & 1 deletion Hash and checksum/List SHA-256
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ _main() {
local std_output=""
std_output=$(_storage_text_read_all)
std_output=$(_text_sort "$std_output")
# shellcheck disable=SC2001
std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_display_list_box "$std_output" "--column=SHA-256;--column=File"
}
Expand All @@ -34,7 +36,7 @@ _main_task() {
std_output=$(_text_remove_pwd "$std_output")

# shellcheck disable=SC2001
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\1$FIELD_SEPARATOR\2|g" <<<"$std_output")
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_storage_text_write_ln "$std_output"
}
Expand Down
4 changes: 3 additions & 1 deletion Hash and checksum/List SHA-512
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ _main() {
local std_output=""
std_output=$(_storage_text_read_all)
std_output=$(_text_sort "$std_output")
# shellcheck disable=SC2001
std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_display_list_box "$std_output" "--column=SHA-512;--column=File"
}
Expand All @@ -34,7 +36,7 @@ _main_task() {
std_output=$(_text_remove_pwd "$std_output")

# shellcheck disable=SC2001
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\1$FIELD_SEPARATOR\2|g" <<<"$std_output")
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_storage_text_write_ln "$std_output"
}
Expand Down
5 changes: 5 additions & 0 deletions Hash and checksum/Produce 'md5sum.txt'
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ _main() {
local std_output=""
std_output=$(_storage_text_read_all)
std_output=$(_text_sort "$std_output")
# shellcheck disable=SC2001
std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2 \1|g" <<<"$std_output")
printf "%s" "$std_output" >"$output_file"

_display_result_box "$output_dir"
Expand All @@ -38,6 +40,9 @@ _main_task() {
std_output=$(md5sum -- "$input_file" 2>/dev/null)
std_output=$(_text_remove_pwd "$std_output")

# shellcheck disable=SC2001
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_storage_text_write_ln "$std_output"
}

Expand Down
5 changes: 5 additions & 0 deletions Hash and checksum/Produce 'sha1sum.txt'
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ _main() {
local std_output=""
std_output=$(_storage_text_read_all)
std_output=$(_text_sort "$std_output")
# shellcheck disable=SC2001
std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2 \1|g" <<<"$std_output")
printf "%s" "$std_output" >"$output_file"

_display_result_box "$output_dir"
Expand All @@ -38,6 +40,9 @@ _main_task() {
std_output=$(sha1sum -- "$input_file" 2>/dev/null)
std_output=$(_text_remove_pwd "$std_output")

# shellcheck disable=SC2001
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_storage_text_write_ln "$std_output"
}

Expand Down
5 changes: 5 additions & 0 deletions Hash and checksum/Produce 'sha256sum.txt'
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ _main() {
local std_output=""
std_output=$(_storage_text_read_all)
std_output=$(_text_sort "$std_output")
# shellcheck disable=SC2001
std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2 \1|g" <<<"$std_output")
printf "%s" "$std_output" >"$output_file"

_display_result_box "$output_dir"
Expand All @@ -38,6 +40,9 @@ _main_task() {
std_output=$(sha256sum -- "$input_file" 2>/dev/null)
std_output=$(_text_remove_pwd "$std_output")

# shellcheck disable=SC2001
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_storage_text_write_ln "$std_output"
}

Expand Down
5 changes: 5 additions & 0 deletions Hash and checksum/Produce 'sha512sum.txt'
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ _main() {
local std_output=""
std_output=$(_storage_text_read_all)
std_output=$(_text_sort "$std_output")
# shellcheck disable=SC2001
std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2 \1|g" <<<"$std_output")
printf "%s" "$std_output" >"$output_file"

_display_result_box "$output_dir"
Expand All @@ -38,6 +40,9 @@ _main_task() {
std_output=$(sha512sum -- "$input_file" 2>/dev/null)
std_output=$(_text_remove_pwd "$std_output")

# shellcheck disable=SC2001
std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output")

_storage_text_write_ln "$std_output"
}

Expand Down

0 comments on commit b98cd2b

Please sign in to comment.