如何列出文件夹中所有 .zip 文件的内容并查找特定文件?

如何列出文件夹中所有 .zip 文件的内容并查找特定文件?

我有 348 个 zip 文件,我想查找其中一个 zip 文件中的一个文件,unzip -l通配符不起作用吗?

我如何列出所有.zip文件的内容以及grep通过合并列表列出 zip 文件中包含的所有文件?

答案1

在这里使用zipinfo是一个很好的解决方案。但是,一般来说,每当您想要将命令应用于文件列表并且该命令不接受文件列表时,您都可以使用循环for

for file in *.zip; do
    unzip -l "$file"
done \
| grep "\.zip\|setup"

如果您要搜索的文件中含有空格(如:)your file,则在 grep 正则表达式中,您需要使用反斜杠转义每个空格(如)grep "\.zip\|your\ file"

答案2

您可以使用zipinfo。它包含在默认的 Ubuntu 安装中。检查手册页了解更多信息。

例如,要setup在当前目录中的一堆 zip 文件中查找模式,请使用以下命令:

find ./ -iname *zip 2> /dev/null -print0 | xargs -0 zipinfo | grep setup

答案3

要列出 zip 存档中的文件,您可以使用以下命令。

unzip -l

要 grep 压缩档案,您应该使用专门为该类型的档案格式构建的压缩档案实用程序。

对于 zip 档案:

zipgrep --help  
usage: zipgrep [egrep_options] pattern zipfile [members...]
Uses unzip and egrep to search the zip members for a string or pattern.

对于 tar 档案:

zgrep --help
Usage: /bin/zgrep [OPTION]... [-e] PATTERN [FILE]...
Look for instances of PATTERN in the input FILEs, using their
uncompressed contents if they are compressed.

OPTIONs are the same as for 'grep'.

还有一些其他工具也可以处理档案。你可以将输出通过管道传输到 grep 中来做同样的事情。

zcat
zcat my.archive.zip | grep "some text"

或者您可以使用这些工具的搜索功能

zless
zmore

答案4

下面是一个dash用于在存档文件内进行搜索的脚本(应该与bashzshkshshell 一起使用):

只需调用不带参数的脚本,脚本就会提示必要的输入:

#!/bin/dash

TestIfFileIsText () {
    #$1 = input file path
    #$2 = returns "true" if the input file is text, "false" otherwise
    
    result="false"
    eval current_file=\"\$$1\"
    current_file_mime_type="$(file -bL --mime-encoding "$current_file" 2>/dev/null)"
    case "$current_file_mime_type" in
        *"ascii"* | *"utf"* )
            result="true"
        ;;
    esac
    eval $2=\"\$result\"
}

ExtractFirstAndLastPathComponent () {
    #$1 = input path
    #$2 = returns the first path component
    #$3 = returns the last path component
    
    eval current_path="\"\$$1\""
    
    first_path_component=""
    last_path_component=""
    
    if [ -n "$current_path" ]; then
        #Remove trailing '/' characters:
        while [ ! "${current_path%"/"}" = "$current_path" ]; do
            current_path="${current_path%"/"}"
        done
        
        if [ -z "$current_path" ]; then
            eval current_path=\"\$$1\"
        fi
        
        last_path_component="${current_path##*"/"}"
        first_path_component="${current_path%"$last_path_component"}"
    fi
    
    eval $2="\"\$first_path_component\""
    eval $3="\"\$last_path_component\""
}

GetFileEncoding () {
    #$1 = input file path
    #$2 = returns the file encoding
    
    eval file_to_test=\"\$$1\"
    
    GetFileSizeInBytes file_to_test file_to_test_size_in_bytes
    
    #Get file mime encoding:
    if [ -d "$file_to_test" ]; then
        result="directory"
    elif [ ! "$file_to_test_size_in_bytes" -eq "0" ]; then
        file_mime_type="$(file -bL --mime-encoding "$file_to_test" 2>/dev/null)" || { file_mime_type="undetermined"; }
        case "$file_mime_type" in
            *"binary"* )
                #Only binary files containing the NULL character (^@) are considered binaries in this script:
                (cat -v "$file_to_test" | sed "/\^@/i'\^@'\$NL2") | { grep -q "\^@"; } && result="binary" || result="text"
            ;;
            *"ascii"* | *"utf"* )
                result="text"
            ;;
            * )
                result="undetermined"
            ;;
        esac
    else
        result="text"
    fi
    eval $2=\"\$result\"
}

GetOSType () {
    #$1 = returns current operating system
        
    case "$(uname -s)" in
    *"Darwin"* | *"BSD"* )
        eval $1="BSD-based"
        ;;
    *"Linux"* )
        eval $1="Linux"
        ;;
    * )
        eval $1="Other"
        ;;
    esac
}

GetFileSizeInBytes () {
    #$1 = the input file path
    #$2 = returns the input file size
    
    eval file="\"\$$1\""
    [ -z "$OS_TYPE" ] && GetOSType OS_TYPE
    if [ "$OS_TYPE" = "Linux" ] || [ "$OS_TYPE" = "Other" ]; then
        file_size_in_bytes="$(stat -c %s -- "$file")" 2>/dev/null || { file_size_in_bytes="-1"; }
    elif [ "$OS_TYPE" = "BSD-based" ]; then
        file_size_in_bytes="$(stat -Lf %z -- "$file")" 2>/dev/null || { file_size_in_bytes="-1"; }
    else
        file_size_in_bytes="-1"
    fi
    eval $2="$file_size_in_bytes"
}

trap1 () {
    printf "\n""Aborted.\n">"$print_to_screen"
    
    CleanUp
        
    #kill all children processes, suppressing "Terminated" message:
    kill -s PIPE -- -$$ 2>/dev/null
    
    exit
}

CleanUp () {
    
    if [ -n "$TEMPORARY_EXTRACT_PATH" ] && [ -n "$TEMPORARY_EXTRACT_FOLDER" ] && [ -n "$output_dir" ]; then
        rm -R -f "$output_dir/"*
    fi
    
    #Restore "INTERRUPT" (CTRL-C) and "TERMINAL STOP" (CTRL-Z) signals:
    trap - INT
    trap - TSTP
    
    #Clear the title:
    printf "\033]0;%s\007" "">"$print_to_screen"
    
    RestoreIFS initial_IFS

}

StoreIFS () {
    eval $1="\"\$IFS\""
}

RestoreIFS () {
    eval IFS="\"\$$1\""
}

GetModifiedFileDateFull () {
    #$1 = the input file path
    #$2 = returns input file modified date
    
    eval input_file=\"\$$1\"
    [ -z "$OS_TYPE" ] && GetOSType OS_TYPE
    {
        if [ "$OS_TYPE" = "Linux" ] || [ "$OS_TYPE" = "Other" ]; then
            current_modified_date_full="$(stat -c "%y" "$input_file")" || { current_modified_date_full="-1"; }
        elif [ "$OS_TYPE" = "BSD-based" ]; then
            current_modified_date_full="$(stat -f "%Sm" "$input_file")" || { current_modified_date_full="-1"; }
        fi
    }||{
        current_modified_date_full="-1"
    }
    eval $2=\"\$current_modified_date_full\"
}

GetModifiedFileDateSSE () {
    #$1 = the input file path
    #$2 = returns input file modified date - Seconds Since Epoch
    
    eval input_file=\"\$$1\"
    [ -z "$OS_TYPE" ] && GetOSType OS_TYPE
    {
        if [ "$OS_TYPE" = "Linux" ] || [ "$OS_TYPE" = "Other" ]; then
            current_modified_date_SSE="$(stat -c "%Y" "$input_file")" || { current_modified_date_SSE="-1"; }
        elif [ "$OS_TYPE" = "BSD-based" ]; then
            current_modified_date_SSE="$(stat -f "%m" "$input_file")" || { current_modified_date_SSE="-1"; }
        fi
    }||{
        current_modified_date_SSE="-1"
    }
    eval $2=\"\$current_modified_date_SSE\"
}

GenerateMatchedFilesArrays () {
    IFS='
'
    i=0
    cd "$initial_dir"
    
    for current_search_path in $(eval find $search_path -prune -exec printf "%s\\\\n" {} + ); do
        
        archive_type_1='.zip'
        archive_type_2='.tar*'
        archive_type_3='.7z'
        archive_type_4='.rar'
        archive_type_5='.bz2'
        archive_type_6='.xz'
        archive_type_7='.gz'
        archive_type_8='.tgz'
        archive_type_9='.tar'       
        if [ ! -d "$current_search_path" ]; then
            ExtractFirstAndLastPathComponent current_search_path fpc_current_search_path lpc_current_search_path
            cd "$initial_dir"; cd "$fpc_current_search_path"; current_search_path="$PWD/$lpc_current_search_path"
            find_commands_1_1="find \"\$current_search_path\" -type f -name \"*.zip*\""
            find_commands_2_1="find \"\$current_search_path\" -type f -name \"*.tar*\""
            find_commands_3_1="find \"\$current_search_path\" -type f -name \"*.7z*\""
            find_commands_4_1="find \"\$current_search_path\" -type f -name \"*.rar\""
            find_commands_5_1="find \"\$current_search_path\" -type f -name \"*.bz2\""
            find_commands_6_1="find \"\$current_search_path\" -type f -name \"*.xz\""
            find_commands_7_1="find \"\$current_search_path\" -type f -name \"*.gz\""
            find_commands_8_1="find \"\$current_search_path\" -type f -name \"*.tgz\""
            find_commands_9_1="find \"\$current_search_path\" -type f -name \"*.tar\""
        elif [ -d "$current_search_path" ]; then
            cd "$initial_dir"; cd "$current_search_path"; current_search_path="$PWD"
            find_commands_1_1="find \"\$current_search_path/.\" -type f -name \"*.zip*\""
            find_commands_2_1="find \"\$current_search_path/.\" -type f -name \"*.tar*\""
            find_commands_3_1="find \"\$current_search_path/.\" -type f -name \"*.7z*\""
            find_commands_4_1="find \"\$current_search_path/.\" -type f -name \"*.rar\""
            find_commands_5_1="find \"\$current_search_path/.\" -type f -name \"*.bz2\""
            find_commands_6_1="find \"\$current_search_path/.\" -type f -name \"*.xz\""
            find_commands_7_1="find \"\$current_search_path/.\" -type f -name \"*.gz\""
            find_commands_8_1="find \"\$current_search_path/.\" -type f -name \"*.tgz\""
            find_commands_9_1="find \"\$current_search_path/.\" -type f -name \"*.tar\""
        fi
        find_commands_0="9"
        extract_to_screen_commands_1_2="unzip -q -c \"\$file2\" $total_in_archive_file_path_filters"
        extract_to_screen_commands_2_2="tar -xOzf \"\$file2\" --wildcards $total_in_archive_file_path_filters"
        extract_to_screen_commands_3_2="7z e \"\$file2\""
        extract_to_screen_commands_4_2="unrar p \"\$file2\""
        extract_to_screen_commands_5_2="bzip2 -dc \"\$file2\""
        extract_to_screen_commands_6_2="xz -dc \"\$file2\""
        extract_to_screen_commands_7_2="gzip -dc \"\$file2\""
        extract_to_screen_commands_8_2="tar -xOf \"\$file2\"" ##NO OUTPUT (Linux)?
        extract_to_screen_commands_9_2="tar -xOf \"\$file2\"" ##NO OUTPUT (Linux)?
        #tar -xOzf '{}'" -> '*.tar.gz'
        #tar -xOjf '{}'" -> '*.tar.bz2'
        #tar -xOJf '{}'" -> '*.tar.xz'
        extract_to_screen_commands_0="9"
        
        for file1 in $(\
            { \
            j=0;\
            for l in $(GenerateSequence 1 $find_commands_0); do \
                eval current_find_command=\"\$find_commands_$l\_1\"; \
                eval current_extract_to_screen_command=\"\$extract_to_screen_commands_$l\_2\"; \
                eval current_archive_type=\"\$archive_type_$l\"
                
                PrintJustInTitle "Step 1: Finding $current_archive_type archive files..."; \
                
                GenerateMatchedFilePaths 1|uniq -d;\
                j=0;\
                
                PrintJustInTitle "Step 2: Finding $current_archive_type archive files..."; \
                
                GenerateMatchedFilePaths 2|uniq -u;\
            done; \
            }|sort --numeric-sort;\
            PrintJustInTitle "Preparing to store necessary file info..."; \
        ); do
            found="false"
            previous_file_path="$current_file_path"
            current_file_path="$file1"
            if [ -z "$previous_file_path" ]; then
                previous_file_path="$current_file_path"
                found="true"
            else
                if [ ! "$current_file_path" = "$previous_file_path" ]; then
                    found="true"
                fi
            fi
            
            if [ "$found" = "true" ]; then
                i=$(($i + 1))
                PrintJustInTitle "Storing necessary file info: file $i..."
                eval current_file_path=\"\$file1\"
                eval archive_paths_$i=\"\$current_file_path\"
                GetModifiedFileDateSSE current_file_path current_file_modified_date_SSE
                eval file_modified_dates_SSE_$i=\"\$current_file_modified_date_SSE\"
                GetModifiedFileDateFull current_file_path current_file_modified_date_full
                if [ ! "${current_file_modified_date_full%"."*" "*}" = "$current_file_modified_date_full" ]; then
                    current_file_modified_date_full_part1="${current_file_modified_date_full%"."*" "*}"
                    current_file_modified_date_full_part2="${current_file_modified_date_full#$current_file_modified_date_full_part1"."*" "}"
                    current_file_modified_date_full="$current_file_modified_date_full_part1$current_file_modified_date_full_part2"
                fi
                eval file_modified_dates_full_$i=\"\$current_file_modified_date_full\"
                GetFileSizeInBytes current_file_path current_file_path_size_in_bytes
                eval file_size_$i=\"\$current_file_path_size_in_bytes\"
            fi
        done;
    done
    eval archive_paths_0=$i
    
    cd "$initial_dir"
    PrintJustInTitle ""
}

GenerateMatchedFilePaths () {
    for file2 in $(\
        eval "$current_find_command";\
    ); do \
        j=$(($j + 1)); \
        PrintJustInTitle "Step $1: Processing file $j..."; \
        GetFileSizeInBytes file2 file2_size_in_bytes; \
        if [ "$file2_size_in_bytes" -le "$max_archive_size_in_bytes" ]; then \
            not_match="false"; \
            for k in $(GenerateSequence 1 $search_strings_array_0); do \
                eval current_search_string=\"\$search_strings_array_$k\";\
                eval $current_extract_to_screen_command 2>/dev/null|grep -l -i "$current_search_string">/dev/null||{ not_match="true"; break; }; \
            done; \
            if [ "$not_match" = "false" ]; then printf '%s\n' "$file2"; fi; \
        fi; \
    done|sort --numeric-sort
}

PrintMatchedFilesInfo () {
    printf '%s\n\n' ">>>">"$print_to_screen"
    sleep 1
    
    for i in $(GenerateSequence 1 $archive_paths_0); do
        PrintJustInTitle "Loading files data: file $i..."
        eval current_file_path=\"\$archive_paths_$i\"
        eval current_file_modified_date_SSE=\"\$file_modified_dates_SSE_$i\"
        eval current_file_modified_date_full=\"\$file_modified_dates_full_$i\"
        eval current_file_size=\"\$file_size_$i\"
        printf "%s \n" "$i"
        printf "%s \n" "$(printf '%05d' "$i")"
        printf "%s \n" "$current_file_path"
        printf "%s \n" "$current_file_modified_date_SSE"
        printf "%s \n" "$current_file_modified_date_full"
        printf "%s \n" "$(printf '%015d%s' "$current_file_size" "B")"
    done
}

CheckUtilities () {
    #Check if any of the necessary utilities is missing:
    error="false"
    
    for utility; do
        which $utility>/dev/null 2>/dev/null || { printf "\n%s\n" "ERROR: the '$utility' utility is not installed!">&2; error="true"; }
    done
}

PrintInTitle () {
    printf "\033]0;%s\007" "$1"
}

PrintJustInTitle () {
    PrintInTitle "$1">"$print_to_screen"
}

PressEnterToExit () {
    printf '%s\n' "Press Enter to exit..."
    read temp
}

GenerateSequence () {
    sequence_start=$(($1))
    sequence_end=$(($2))
    if [ "$sequence_start" -le "$sequence_end" ]; then
        seq $sequence_start $sequence_end
    fi
}


set +f #Enable globbing (POSIX compliant)
setopt no_nomatch 2>/dev/null #Enable globbing (zsh)

print_to_screen='/dev/tty' #Print text to screen only
Q="'"
max_archive_size_in_bytes=100000000 #approx. 100 MB
initial_dir="$PWD"
StoreIFS initial_IFS

NL2=$(printf '%s' "\n\n") #Store New Line for use with sed

GetOSType OS_TYPE

CheckUtilities stat mkdir rmdir unzip cat grep seq find sed file rm uniq sort

#Trap "INTERRUPT" (CTRL-C) and "TERMINAL STOP" (CTRL-Z) signals:
trap 'trap1' INT
trap 'trap1' TSTP

{
    [ "$OS_TYPE" = "Linux" ] && [ -e '/dev/shm' ] && {
        TEMPORARY_EXTRACT_PATH='/dev/shm'
        which gedit && {
            editor_open_in_same_window_and_wait="gedit -w"
            editor_open_in_new_window_and_wait="gedit --new-window -w"
            editor_open_new_blank_window_and_wait="$editor_open_in_new_window_and_wait"
        } || {
            which kate && {
                editor_open_in_same_window_and_wait="kate -w"
                editor_open_in_new_window_and_wait="kate -n -w"
                editor_open_new_blank_window_and_wait="$editor_open_in_new_window_and_wait"
            }
        }
    } 2>/dev/null || {
        [ "$OS_TYPE" = "BSD-based" ] && [ -e "$HOME" ] && {
            TEMPORARY_EXTRACT_PATH="$HOME"
            which bbedit && {
                editor_open_in_same_window_and_wait="bbedit -w"
                editor_open_in_new_window_and_wait="bbedit --new-window -w"
                editor_open_new_blank_window_and_wait="$editor_open_in_new_window_and_wait"
            } 2>/dev/null || {
                printf "ERROR: Text editor not found (gedit / kate / bbedit)\!\n">&2; PressEnterToExit; exit 1
            }
        }
    } || {
        printf 'ERROR: Unsupported OS!'>&2; sleep 1; exit 1
    }
    TEMPORARY_EXTRACT_FOLDER='TEMP_EXTR_FOLDER'
}>/dev/null

if [ "$error" = "true" ]; then
    printf "\n">&2
    CleanUp; exit 1
fi

eval find /dev/null $find_search_archive_total_path_filter>/dev/null || {
    printf "%s\n\n" "ERROR: Invalid find parameters provided!">&2; CleanUp; exit 1
}

initial_dir="$PWD"

output_dir=""
error="false"
{
    cd "$TEMPORARY_EXTRACT_PATH" && {
        if [ ! -e "$TEMPORARY_EXTRACT_FOLDER" ]; then
            printf '%s\n' "The specified temporary directory: \"$TEMPORARY_EXTRACT_FOLDER\" - does not exist in the specified location: \"$TEMPORARY_EXTRACT_PATH\" - do you want to create it? [ Yes / No ] (default=Enter=No): ">"$print_to_screen"
            read answer
            if [ "$answer" = "Yes" ] || [ "$answer" = "yes" ] || [ "$answer" = "Y" ] || [ "$answer" = "y" ]; then
                mkdir "$TEMPORARY_EXTRACT_FOLDER" || error="true"
            fi
        fi
        cd "$TEMPORARY_EXTRACT_FOLDER" && output_dir="$PWD" || {
            error="true"
        }
    } || error="true"
} 2>/dev/null
if [ "$error" = "true" ]; then
    printf '%s\n' "Error: Could not access temporary folder \"$TEMPORARY_EXTRACT_FOLDER\" in the extract location: \"$TEMPORARY_EXTRACT_PATH\"!">&2; PressEnterToExit; exit 1
fi

cd "$initial_dir"
printf "\n"
printf '%s\n' "Current_path = \"$initial_dir\"";
printf "\n"
printf '%s\n' "Where to search path (unquoted (raw)) (default=Enter=.): "
printf '%s' ">> where to search path: >> "
read search_path; [ -z "$search_path" ] && search_path="."
eval [ ! -e "$search_path" ] && { printf '%s\n' "ERROR: The provided search path: \"$search_path\" does not exist!">&2; PressEnterToExit; exit 1; }
eval [ -d "$search_path" ] && { cd "$search_path" || { printf '%s\n' "ERROR: Could not access search dir: \"$search_path\"!">&2; PressEnterToExit; exit 1; }; cd "$initial_dir"; } 

printf '\n%s\n' "In-archive file path filter(s): (what file path to lookup in the archive) (default=Enter=\"*\"):">"$print_to_screen"
current_in_archive_file_path_filter="not_defined"
i=0;
while [ -n "$current_in_archive_file_path_filter" ]; do
    printf '%s' ">> add in-archive path filter (concatenated with logical OR): >> "
    IFS= read -r current_in_archive_file_path_filter
    RestoreIFS initial_IFS
    if [ -n "$current_in_archive_file_path_filter" ]; then
        i=$(($i + 1))
        eval in_archive_file_path_filters_$i=\"\$current_in_archive_file_path_filter\"
        total_in_archive_file_path_filters="$total_in_archive_file_path_filters $current_in_archive_file_path_filter"
    fi
done
if [ "$i" = "0" ]; then
    i=$(($i + 1))
    in_archive_file_path_filters_1='"*"'
fi
in_archive_file_path_filters_0=$i

printf '\n%s\n' "Search string:">"$print_to_screen";
current_search_string="not_defined"
search_strings_array_0=0
i=0
while [ -n "$current_search_string" ]; do
    printf '%s' ">> add search string (concatenated with logical AND): >> "
    IFS= read -r current_search_string
    RestoreIFS initial_IFS
    if [ -n "$current_search_string" ]; then
        i=$(($i + 1))
        eval search_strings_array_$i=\"\$current_search_string\"
    fi
done
if [ ! "$i" = "0" ]; then
    eval search_strings_array_0=$i
else
    search_strings_array_1=""
    search_strings_array_0=1
fi

printf '\n%s' "Also open files that match the file path filters but don't match the search string(s) (open them as a secondary group of files (in the same editor window))? [ Yes / No ] (default=Enter=No): "
read answer
if [ "$answer" = "Yes" ] || [ "$answer" = "yes" ] || [ "$answer" = "Y" ] || [ "$answer" = "y" ]; then
    open_non_match_string_files="true"
else
    open_non_match_string_files="false"
fi

IFS='
'

cd "$initial_dir"

printf "\n">"$print_to_screen"

GenerateMatchedFilesArrays
pmfi_result="defined"
count=0
while [ -n "$pmfi_result" ]; do
    PrintJustInTitle "Loading files data..."
    
    count=$(($count + 1))
    
    pmfi_result=$(zenity --list --separator='|' --multiple --width "1900" --height "900" --hide-column='1' --print-column='1' --column "Hidden column" --column "File Path number" --column "File Path" --column "Modified Date number" --column "Modified Date" --column "File Size" $(PrintJustInTitle "Loading files data..."; PrintMatchedFilesInfo; PrintJustInTitle "Please select archives to preview..."))
    
    sequence="$pmfi_result"
    t=0
    temp=""
    while [ ! "$temp" = "$sequence" ]; do
        temp="$sequence"
        current_number="${temp%%"|"*}"
        t=$(($t + 1))
        eval numbers_$t=$(($current_number))
        sequence="${temp#*$number*"|"}"
    done
    numbers_0=$t
    
    RestoreIFS initial_IFS
    
    j=0
    for i in $(GenerateSequence 1 $numbers_0); do
        
        eval current_number=\"\$numbers_$i\"
        
        padded_number="$(printf '%05d' "$current_number")"
        eval current_archive_path=\"\$archive_paths_$current_number\"
        full_current_archive_path="$current_archive_path"
        
        ExtractFirstAndLastPathComponent current_archive_path fpc_current_archive_path lpc_current_archive_path
        cd "$fpc_current_archive_path"
        fpc_current_archive_path="$PWD"
        
        ExtractFirstAndLastPathComponent fpc_current_archive_path fpc_fpc_current_archive_path lpc_fpc_current_archive_path
        current_archive_name_ext="${lpc_current_archive_path}"
        current_archive_name_ext_plus="${current_archive_name_ext}""_extract"
        full_current_archive_extract_to_path="$output_dir/$padded_number/$lpc_fpc_current_archive_path/$current_archive_name_ext_plus"
        
        if [ ! -e "$full_current_archive_extract_to_path" ]; then
            cd "$output_dir"
            mkdir "$padded_number"
            cd "$padded_number"
            mkdir "$lpc_fpc_current_archive_path"
            cd "$lpc_fpc_current_archive_path"
            mkdir "$current_archive_name_ext_plus"
            cd "$current_archive_name_ext_plus"
            
            case "$current_archive_path" in
                *'.zip' )
                    unzip "$full_current_archive_path" -d "$full_current_archive_extract_to_path"
                ;;
                *'.7z' )
                    7z x "$full_current_archive_path" -o"$full_current_archive_extract_to_path/"
                ;;
                *'.rar' )
                    unrar x "$full_current_archive_path" "$full_current_archive_extract_to_path/"
                ;;
                *'.bz2' | *'.xz' | *'.gz' )
                    cp "$full_current_archive_path" "$full_current_archive_extract_to_path"
                    case "$current_archive_path" in
                        *'.bz2' ) bzip2 "$full_current_archive_extract_to_path/""$current_archive_name_ext" -d "$full_current_archive_extract_to_path"; ;;
                        *'.xz' ) xz "$full_current_archive_extract_to_path/""$current_archive_name_ext" -d "$full_current_archive_extract_to_path"; ;;
                        *'.gz' ) gzip -d "$full_current_archive_extract_to_path/""$current_archive_name_ext"; ;;
                    esac
                    case "${current_archive_name_ext%"."*}" in
                        *'.tar' )
                            tar -xvf "$full_current_archive_extract_to_path/${current_archive_name_ext%"."*}" -C "$full_current_archive_extract_to_path"
                            rm "$full_current_archive_extract_to_path/${current_archive_name_ext%"."*}"
                        ;;
                    esac
                ;;
                *'.tgz' | *'.tar' )
                    tar -xvf "$full_current_archive_path" -C "$full_current_archive_extract_to_path"
                ;;
            esac >/dev/null 2>/dev/null
        else
            cd "$full_current_archive_extract_to_path"
        fi
        
        new_group=""
        
        for m in $(GenerateSequence 1 $in_archive_file_path_filters_0); do
            eval current_in_archive_path_filter=\"\$in_archive_file_path_filters_$m\"
            IFS=' '
            for current_group_no in 1 2; do
                IFS='
'
                if [ "$current_group_no" = "2" ] && [ -z "$new_group" ]; then
                    break
                fi
                for current_in_archive_file_path in $(eval find . -type f -path $current_in_archive_path_filter|sort --numeric-sort); do
                    TestIfFileIsText current_in_archive_file_path in_archive_file_is_text
                    if [ "$in_archive_file_is_text" = "true" ]; then
                        matched_group="1"
                        for k in $(GenerateSequence 1 $search_strings_array_0); do
                            eval current_search_string=\"\$search_strings_array_$k\"
                            cat "$full_current_archive_extract_to_path/$current_in_archive_file_path"|grep -l -i "$current_search_string">/dev/null||{ matched_group="2"; break; }
                        done
                        
                        if [ "$matched_group" = "$current_group_no" ]; then
                            esc_full_current_extr_file_path="$(printf '%s\n' "$full_current_archive_extract_to_path/$current_in_archive_file_path"|sed "s/'/$Q\"\$Q\"$Q/g")"; new_group="$new_group"" ""'$esc_full_current_extr_file_path'"
                        fi
                    fi
                done
                IFS=' '
            done
            RestoreIFS initial_IFS
        done
        
        if [ -n "$new_group" ]; then
            j=$(($j + 1))
            eval groups_$j=\"\$new_group\"
            eval matched_archive_paths_$j=\"\$current_archive_path\"
        fi
    done
    
    groups_0=$j
    matched_archive_paths_0=$j
    
    RestoreIFS initial_IFS
    first_time="true"
    for i in $(GenerateSequence 1 $groups_0); do
        eval current_group="\"\$groups_$i\""
        if [ "$first_time" = "true" ]; then
            { eval $editor_open_new_blank_window_and_wait & }
            sleep 0.5
            { eval $editor_open_in_same_window_and_wait "$current_group" & }
            first_time="false"
        else
            { eval $editor_open_in_new_window_and_wait "$current_group" & }
        fi
        sleep 0.5
    done
    
    IFS='
'
done
RestoreIFS initial_IFS

PrintJustInTitle "Exiting..."; sleep 1; CleanUp
cd "$initial_dir"

相关内容