Как составить список содержимого всех файлов.zip в папке и grep для конкретного файла?

У меня есть 348 zip-файлов, и я хочу найти файл, который находится в одном из zip-файлов, unzip -l не работает с джокерами?

Как я могу перечислить содержание всех .zip файлы и grep через объединенный список всех файлов, содержащихся в почтовых индексах?

4 ответа

Решение

С помощью zipinfo это хорошее решение здесь. Однако, в общем случае, когда вы хотите применить команду к списку файлов, и команда не принимает список файлов, вы можете использовать for цикл:

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

Если в файле, который вы ищете, есть пробелы, например: your file, в регулярном выражении grep вам нужно экранировать все пробелы с обратной косой чертой, как grep "\.zip\|your\ file",

Ты можешь использовать zipinfo, Он включен в стандартную установку Ubuntu. Проверьте страницу руководства для получения дополнительной информации.

Например, чтобы найти шаблон setup в куче zip-файлов в текущем каталоге используйте эту команду:

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

Чтобы составить список файлов в zip-архиве, вы можете использовать следующую команду.

unzip -l

Чтобы выполнить сжатие сжатого архива, вы должны использовать утилиты сжатого архива, созданные для работы с этим типом формата архива.

Для почтовых архивов:

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

Вотdashскрипт, который я написал для поиска внутри.zipфайлы (должно работать сbash,zsh,kshснаряды):

Просто вызовите сценарий без параметров, и он запросит необходимые данные :

  • zip-файлыsearch location(местоположение может быть: параметр папки ИЛИ параметры отдельных zip-файлов)
  • name and extension filtersдля zip-файлов
  • strings to searchдля внутри zip-файлов
      #!/bin/dash

ExtractFirstAndLastPathComponent () {
    error_EFALPC="false"
    current_function_name="ExtractFirstAndLastPathComponent"
    if [ -z "$1" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected first variable name (containing the input path)!"
        error_EFALPC="true"
    fi
    if [ -z "$2" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected second variable name (returns the first path component)!"
        error_EFALPC="true"
    fi
    if [ -z "$3" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected third variable name (returns the last path component)!"
        error_EFALPC="true"
    fi
    if [ "$error_EFALPC" = "true" ]; then
        CleanUp; exit 1
    fi
    
    eval current_path="\"\$$1\""
    
    first_path_component=""
    last_path_component=""
    
    if [ -n "$current_path" ]; then
        #Remove trailing '/':
        temp="${current_path%?}"
        while [ "${current_path#"$temp"}" = "/" ]; do
            current_path="${current_path%?}"
            temp="${current_path%?}"
        done
        first_path_component="${current_path%"/"*}"
        if [ -z "$first_path_component" ]; then
            last_path_component="${current_path#'/'}"
        else
            last_path_component="${current_path#"$first_path_component""/"}"
        fi
    fi
    
    eval $2="\"\$first_path_component\""
    eval $3="\"\$last_path_component\""
}

GetFileEncoding () {
    error_GFE="false"
    current_function_name="GetFileEncoding"
    if [ -z "$1" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected first variable name (containing the input file path)!"
        error_GFE="true"
    fi
    if [ -z "$2" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected second variable name (returns file encoding)!"
        error_GFE="true"
    fi
    if [ "$error_GFE" = "true" ]; then
        CleanUp; exit 1
    fi
    
    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 () {
    current_function_name="GetOSType"
    if [ -z "$1" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected variable name (returns current operating system)!"
        CleanUp; exit 1
    fi
    
    case "$(uname -s)" in
    *"Darwin"* | *"BSD"* )
        eval $1="BSD-based"
        ;;
    *"Linux"* )
        eval $1="Linux"
        ;;
    * )
        eval $1="Other"
        ;;
    esac
}

GetFileSizeInBytes () {
    error_GFSIB="false"
    current_function_name="GetFileSizeInBytes"
    if [ -z "$1" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected first variable name (containing the input file path)!"
        error_GFSIB="true"
    fi
    if [ -z "$2" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected second variable name (returns the input file size)!"
        error_GFSIB="true"
    fi
    if [ "$error_GFSIB" = "true" ]; then
        CleanUp; exit 1
    fi
    
    eval file="\"\$$1\""
    [ -z "$OS_TYPE" ] && GetOSType OS_TYPE
    if [ "$OS_TYPE" = "BSD-based" ]; then
        file_size_in_bytes="$(stat -Lf %z -- "$file")" 2>/dev/null || { file_size_in_bytes="-1"; }
    elif [ "$OS_TYPE" = "Linux" ] || [ "$OS_TYPE" = "Other" ]; then
        file_size_in_bytes="$(stat -c %s -- "$file")" 2>/dev/null || { file_size_in_bytes="-1"; }
    else
        file_size_in_bytes="-1"
    fi
    eval $2="$file_size_in_bytes"
}

ReadRaw () {
    current_function_name="ReadRaw"
    if [ -z "$1" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected input variable name (returns current read line (including extra SPACE characters))!"
        CleanUp; exit 1
    fi
    
    initial_IFS="$IFS"
    
    IFS= read -r $1
    
    #Restore initial IFS:
    unset IFS
    
    eval value=\"\$$1\"
    
    if [ -n "$value" ]; then printf "\n"; fi
}

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

CleanUp () {

    rm -R -f "$output_dir/"*;
    
    #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"
    
    #Restore initial IFS:
    unset IFS
    
    ##Restore initial directory:
    #cd "$initial_dir"

}

GetModifiedFileDateFull () {
    error_GMFDF="false"
    current_function_name="GetModifiedFileDateFull"
    if [ -z "$1" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected first variable name (containing the input file path)!"
        error_GMFDF="true"
    fi
    if [ -z "$2" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected second variable name (returns input file modified date)!"
        error_GMFDF="true"
    fi
    if [ "$error_GMFDF" = "true" ]; then
        CleanUp; exit 1
    fi
    
    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 () {
    error_GMFDSSE="false"
    current_function_name="GetModifiedFileDateSSE"
    if [ -z "$1" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected first variable name (containing the input file path)!"
        error_GMFDSSE="true"
    fi
    if [ -z "$2" ]; then
        ErrorMessage "ERROR: $current_function_name: Expected second variable name (returns input file modified date - Seconds Since Epoch)!"
        error_GMFDSSE="true"
    fi
    if [ "$error_GMFDSSE" = "true" ]; then
        CleanUp; exit 1
    fi
    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
    for file1 in $(\
        { \
        j=0;\
        PrintJustInTitle "Step 1: Preparing to process files..."
        for file2 in $(\
            eval "$find_zip_command";\
        ); do \
            j=$(($j + 1))
            PrintJustInTitle "Step 1: Processing file $j..."
            file3="$search_path_full_path$file2"; \
            GetFileSizeInBytes file3 file3_size_in_bytes; \
            if [ "$file3_size_in_bytes" -le "$max_arhive_size_in_bytes" ]; then \
                not_match="false"; \
                for k in $(seq 1 $search_strings_array_0); do \
                    eval current_search_string=\"\$search_strings_array_$k\";\
                    eval unzip -q -c \"\$file3\" "$unzip_total_inside_archive_file_name_and_extension_filter" 2>/dev/null|grep -l -i "$current_search_string">/dev/null||{ not_match="true"; break; }; \
                done; \
                if [ "$not_match" = "false" ]; then printf '%s\n' "$file3"; fi; \
            fi; \
        done|eval $sort_command|uniq -d;\
        j=0;\
        PrintJustInTitle "Step 2: Preparing to process files..."
        for file2 in $(\
            eval "$find_zip_command";\
        ); do \
            j=$(($j + 1))
            PrintJustInTitle "Step 2: Processing file $j..."
            file3="$search_path_full_path$file2"; \
            GetFileSizeInBytes file3 file3_size_in_bytes; \
            if [ "$file3_size_in_bytes" -le "$max_arhive_size_in_bytes" ]; then \
                not_match="false"; \
                for k in $(seq 1 $search_strings_array_0); do \
                    eval current_search_string=\"\$search_strings_array_$k\";\
                    eval unzip -q -c \"\$file3\" "$unzip_total_inside_archive_file_name_and_extension_filter" 2>/dev/null|grep -l -i "$current_search_string">/dev/null||{ not_match="true"; break; }; \
                done; \
                if [ "$not_match" = "false" ]; then printf '%s\n' "$file3"; fi; \
            fi; \
        done|eval $sort_command|uniq -u;\
        }|eval $sort_command;\
        PrintJustInTitle "Storing 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 file_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;
    eval file_paths_0=$i
    PrintJustInTitle ""
}

PrintMatchedFilesInfo () {
    PrintJustInTitle "Loading files data..."
    for i in $(seq 1 $file_paths_0); do
        PrintJustInTitle "Loading files data: file $i..."
        eval current_file_path=\"\$file_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
    PrintJustInTitle "Loading files data..."
}

CheckUtilities () {
    #Check if any of the necessary utilities is missing:
    error="false"
    
    for utility; do
        man -f $utility >/dev/null 2>/dev/null || { ErrorMessage "ERROR: the '$utility' utility is not installed!"; error="true"; }
    done>&2
    
    if [ "$error" = "true" ]; then
        CleanUp; exit 1
    fi
}

ErrorMessage () {
    printf '\n%s\n' "$1">&2
}

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

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


print_to_screen='/dev/tty' #print to screen only

max_arhive_size_in_bytes=100000000 #approx. 100 MB

Q="'"

GetOSType OS_TYPE
if [ "$OS_TYPE" = "Linux" ] || [ "$OS_TYPE" = "Other" ]; then
    TEMPORARY_EXTRACT_PATH='/dev/shm' #RAM MEMORY
    
    man -f sort>/dev/null 2>/dev/null||{ ErrorMessage "ERROR: The \"sort\" utility is not installed!"; error="true"; }
    sort_command="sort -n"
    
    man -f zenity>/dev/null 2>/dev/null||{ ErrorMessage "ERROR: The \"zenity\" utility is not installed!"; error="true"; }
elif [ "$OS_TYPE" = "BSD-based" ]; then
    TEMPORARY_EXTRACT_PATH="$HOME" #$HOME folder
    
    man -f gsort>/dev/null 2>/dev/null||{ ErrorMessage "ERROR: The \"gsort\" utility is not installed - it can be installed with: \"brew install coreutils\""; error="true"; }
    sort_command="gsort -n"
    
    man -f zenity>/dev/null 2>/dev/null||{ ErrorMessage "ERROR: The \"zenity\" utility is not installed - it can be installed with: \"brew install zenity\"!"; error="true"; }
fi

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

if [ "$OS_TYPE" = "Linux" ] || [ "$OS_TYPE" = "Other" ]; then
    editor_command="gedit --new-window"
    man -f gedit >/dev/null 2>/dev/null || {
        ErrorMessage "ERROR: the 'gedit' utility is not installed!"
        error="true"
    }
elif [ "$OS_TYPE" = "BSD-based" ]; then
    editor_command="edit --new-window"
    man -f edit >/dev/null 2>/dev/null || {
        ErrorMessage "ERROR: the 'edit' utility is not installed (TextWrangler/BBEdit command-line tools)!"
        error="true"
    }
fi

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

###

initial_dir="$PWD"

cd "$TEMPORARY_EXTRACT_PATH" && {
    if [ ! -e "TEMP_EXTRACT_FOLDER" ]; then
        mkdir "TEMP_EXTRACT_FOLDER" || {
            printf '%s\n' "Error: Could not create temporary folder \"TEMP_EXTRACT_FOLDER\" in the extract location: $TEMPORARY_EXTRACT_PATH!">&2
            exit 1
        }
    fi
    cd "TEMP_EXTRACT_FOLDER" && {
        output_dir="$PWD"
    } || {
        printf '%s\n' "Error: Could not access temporary folder \"TEMP_EXTRACT_FOLDER\" in the extract location: $TEMPORARY_EXTRACT_PATH!">&2
        exit 1
    }
} || {
    printf '%s\n' "Error: Could not access temporary extract location: $TEMPORARY_EXTRACT_PATH!">&2
    exit 1
}

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

printf '\n%s\n' "Where to search path (if within double quotes (\"...\"): special characters have to be escaped with backslash (\) / if within single quotes ('...') special characters don't have to be escaped): "
printf '%s' ">> where to search path: >> "
read search_path;

printf '\n%s\n' "Archive file name and extension filter: (what file name and extension to lookup inside the archive) (default=Enter=*):">"$print_to_screen"
current_inside_archive_file_name_and_extension_filter="defined"
find_total_inside_archive_file_name_and_extension_filter=""
unzip_total_inside_archive_file_name_and_extension_filter=""
i=0;
while [ -n "$current_inside_archive_file_name_and_extension_filter" ]; do
    printf '%s' ">> add name and extension filter (concatenated with logical OR): >> "
    ReadRaw current_inside_archive_file_name_and_extension_filter
    if [ -n "$current_inside_archive_file_name_and_extension_filter" ]; then
        i=$(( $i + 1 ))
        if [ ! "$current_inside_archive_file_name_and_extension_filter" = "${current_inside_archive_file_name_and_extension_filter%*"*"*}" ] || [ ! "$current_inside_archive_file_name_and_extension_filter" = "${current_inside_archive_file_name_and_extension_filter%*"?"*}" ]; then # * and ? characters are treated literaly
            if [ -z "$find_total_inside_archive_file_name_and_extension_filter" ]; then
                find_total_inside_archive_file_name_and_extension_filter="-name ""'""$current_inside_archive_file_name_and_extension_filter""'"
            else
                find_total_inside_archive_file_name_and_extension_filter="$find_total_inside_archive_file_name_and_extension_filter -o -name ""'""$current_inside_archive_file_name_and_extension_filter""'"
            fi
        else
            if [ -z "$find_total_inside_archive_file_name_and_extension_filter" ]; then
                find_total_inside_archive_file_name_and_extension_filter="-name ""$current_inside_archive_file_name_and_extension_filter"
            else
                find_total_inside_archive_file_name_and_extension_filter="$find_total_inside_archive_file_name_and_extension_filter -o -name ""$current_inside_archive_file_name_and_extension_filter"
            fi
        fi
        unzip_total_inside_archive_file_name_and_extension_filter="$unzip_total_inside_archive_file_name_and_extension_filter"" ""$current_inside_archive_file_name_and_extension_filter"
    fi
done
if [ "$i" = "0" ]; then
    find_total_inside_archive_file_name_and_extension_filter='-name '"'"'*'"'"
    unzip_total_inside_archive_file_name_and_extension_filter="'"'*'"'"
fi

printf '\n%s\n' "Search string:">"$print_to_screen";
current_search_string="defined"
search_strings_array_0=0
i=
while [ -n "$current_search_string" ]; do
    printf '%s' ">> add search string (concatenated with logical AND): >> "
    ReadRaw current_search_string
    if [ -n "$current_search_string" ]; then
        i=$(( $i + 1 ))
        eval search_strings_array_$i=\"\$current_search_string\"
    fi
done
if [ -n "$i" ]; then
    eval search_strings_array_0=$i
fi

printf '\n%s' "Also open files that match the file name and extension(s) 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 open_non_match_string_files
if [ "$open_non_match_string_files" = "Yes" ] || [ "$open_non_match_string_files" = "yes" ] || [ "$open_non_match_string_files" = "Y" ] || [ "$open_non_match_string_files" = "y" ]; then
    open_non_match_string_files="yes"
else
    open_non_match_string_files="no"
fi

IFS='
'

cd "$TEMPORARY_EXTRACT_PATH"

rmdir "TEMP_EXTRACT_FOLDER" || {
    printf '%s\n' "Error: Could not remove \"TEMP_EXTRACT_FOLDER\" directory in: "$TEMPORARY_EXTRACT_PATH" - directory not empty (for security reasons - it has to be removed manualy)!">&2
    exit 1
} && {
    mkdir "TEMP_EXTRACT_FOLDER"
}

unset IFS

IFS='
'

cd "$initial_dir"
case "$search_path" in
    *".zip" | *".zip'" | *".zip\"" )
        find_zip_command="find "$search_path" -type f -name \"*.zip\""
    ;;
    * )
        eval cd "$search_path" && search_path_full_path="$PWD/"
        ##cd "$search_path_full_path"
        find_zip_command="find . -type f -name \"*.zip\""
    ;;
esac

GenerateMatchedFilesArrays
pmfi_result="defined"
while [ -n "$pmfi_result" ]; do
    PrintJustInTitle "Loading files data..."
    
    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" $(PrintMatchedFilesInfo))
    
    PrintJustInTitle "Processing files data..."
    
    sequence=""
    pmfi_result_temp="$pmfi_result"
    while [ -n "$pmfi_result_temp" ]; do
        number="${pmfi_result_temp%%"|"*}"
        if [ -z "$sequence" ]; then
            sequence="$number" 
        else
            sequence="$sequence"" ""$number" 
        fi
        pmfi_result_temp="${pmfi_result_temp#"$number"}"
        pmfi_result_temp="${pmfi_result_temp#"|"}"
    done
    
    j=0
    unset IFS
    for i in $sequence; do
        
        padded_number="$(printf '%05d' "$i")"
        
        j=$(( $j + 1 ))
        
        eval current_file_path=\"\$file_paths_$i\"
        
        ExtractFirstAndLastPathComponent current_file_path fpc_current_file_path lpc_current_file_path
        
        cd "$fpc_current_file_path"
        fpc_current_file_path="$PWD"
        cd "$search_path_full_path"
        
        ExtractFirstAndLastPathComponent fpc_current_file_path fpc_fpc_current_file_path lpc_fpc_current_file_path
        archive_name="${lpc_current_file_path%".zip"}"
        if [ ! -e "$output_dir/$padded_number/$lpc_fpc_current_file_path/$archive_name" ]; then
            cd "$output_dir"
            mkdir "$padded_number"
            cd "$padded_number"
            mkdir "$lpc_fpc_current_file_path"
            cd "$lpc_fpc_current_file_path"
            mkdir "$archive_name"
            cd "$archive_name"
            unzip -q "$current_file_path" -d "$output_dir/$padded_number/$lpc_fpc_current_file_path/$archive_name" 2>/dev/null
        else
            cd "$output_dir/$padded_number/$lpc_fpc_current_file_path/$archive_name"
        fi
        IFS='
'
        new_group=""
        
        for file3 in $(eval find . -type f "$find_total_inside_archive_file_name_and_extension_filter"); do
            GetFileEncoding file3 file3_encoding
            if [ "$file3_encoding" = "text" ]; then
                path4="$(printf '%s\n' "$output_dir/$padded_number/$lpc_fpc_current_file_path/$archive_name/$file3"|sed "s/'/$Q\"\$Q\"$Q/g")"
                not_match="false"
                for k in $(seq 1 $search_strings_array_0); do
                    eval current_search_string=\"\$search_strings_array_$k\"
                    cat "$output_dir/$padded_number/$lpc_fpc_current_file_path/$archive_name/$file3"|grep -l -i "$current_search_string">/dev/null||{ not_match="true"; break; }
                done
                if [ "$not_match" = "false" ]; then
                    new_group="$new_group"" ""'$path4'";
                fi
            fi
        done
        
        if [ "$open_non_match_string_files" = "yes" ]; then
            for file3 in $(eval find . -type f "$find_total_inside_archive_file_name_and_extension_filter"); do
                GetFileEncoding file3 file3_encoding
                if [ "$file3_encoding" = "text" ]; then
                    path4="$(printf '%s\n' "$output_dir/$padded_number/$lpc_fpc_current_file_path/$archive_name/$file3"|sed "s/'/$Q\"\$Q\"$Q/g")"
                    not_match="false"
                    for k in $(seq 1 $search_strings_array_0); do
                        eval current_search_string=\"\$search_strings_array_$k\"
                        cat "$output_dir/$padded_number/$lpc_fpc_current_file_path/$archive_name/$file3"|grep -l -i "$current_search_string">/dev/null||{ not_match="true"; break; }
                    done
                    if [ "$not_match" = "true" ]; then
                        new_group="$new_group"" ""'$path4'";
                    fi
                fi
            done
        fi
        
        eval groups_$j=\"\$new_group\"
    done
    
    groups_0=$j
    
    if [ ! "$groups_0" = "0" ]; then
        for i in $(seq 1 $groups_0); do
            eval current_group="\"\$groups_$i\""
            eval $editor_command "$current_group" &
        done
    fi
    IFS='
'
done
unset IFS

CleanUp
cd "$initial_dir"
Другие вопросы по тегам