CustomGridDividerItemDecoration

·

1 min read

/code

Certainly! Here's a simple shell script that should help you achieve the desired format conversion:

#!/bin/bash

input_file="input.txt"
output_file="output.txt"

# Check if the input file exists
if [ ! -f "$input_file" ]; then
    echo "Error: Input file not found."
    exit 1
fi

# Read each line from the input file and perform the conversion
while IFS= read -r line; do
    if [[ $line =~ Implementation\ \'([^\']+)\' ]]; then
        dependency=$(echo "${BASH_REMATCH[1]}" | sed 's/:/./g')
        group=$(echo "$dependency" | cut -d '.' -f1)
        name=$(echo "$dependency" | cut -d '.' -f2)
        version=$(echo "$dependency" | cut -d '.' -f3)
        version_ref="ver-$name"

        # Output to the console
        echo "$dependency : \"$version\""
        echo "$group.$name = { group = \"$group\", name = \"$name\", version.ref = \"$version_ref\"}" >> "$output_file"
    fi
done < "$input_file"

echo "Conversion complete. Check '$output_file' for the formatted output."

This script assumes your input file is named "input.txt" and will output the formatted results to "output.txt". Adjust the input and output file names as needed. Also, make sure to give execute permissions to the script using chmod +xscript.sh before running it.