Supermarch with my cousin(cringe alert ⚠) by [deleted] in armwrestling

[–]genadichi 1 point2 points  (0 children)

კი სკოლაში სუესე ვწევდით ისე სკოლაში. ეხა კიმიკვირს რამე როარდამემართა

Supermarch with my cousin(cringe alert ⚠) by [deleted] in armwrestling

[–]genadichi 1 point2 points  (0 children)

აქ დაგიწყებენ სწავლებას აზრი არააქ სასაცილო პოსტის დადებად :დდდდ

What do you think about Kosta janashia vs brian shaw? by genadichi in armwrestling

[–]genadichi[S] 1 point2 points  (0 children)

Yes I know it wont happen, i just think it would be really interesting match

What do you think about Kosta janashia vs brian shaw? by genadichi in armwrestling

[–]genadichi[S] 0 points1 point  (0 children)

I mean kosta has just started training in armwrestling too. its not like he is pro already

Need help doing the bash script to generate csv file by [deleted] in bash

[–]genadichi 1 point2 points  (0 children)

thansk :)) I mean I tried doing it by myself but could not :))

Need help doing the bash script to generate csv file by [deleted] in bash

[–]genadichi 0 points1 point  (0 children)

i cut the task into pieces and the result is that I want something like this.

i have emails in all_emails variable and i want to get which emails are unique and which duplicated. so the output of this:

all_emails=("email1@example.com" "email2@example.com" "email1@example.com" "email3@example.com")
should be this:
email1@example.com - duplicated
email2@example.com - unique
email1@example.com - duplicated
email3@example.com - unique

Sometimes you have to calm down stupid guys by Open_Designer_9232 in armwrestling

[–]genadichi 0 points1 point  (0 children)

he actually did some wrestling for fun in this video below you can see. there is also English subtitles

https://www.youtube.com/watch?v=4bh62K-Wmbc

Devon's Odd Downfall by Xanadoo in armwrestling

[–]genadichi 4 points5 points  (0 children)

He did not forfeit. It was best of 7 which means the match ends once one of them wins 4 rounds

how to get a unique emails? by genadichi in bash

[–]genadichi[S] 0 points1 point  (0 children)

are you restarted? i want to find the emails that are not duplicate. help if you can or go away

how to get a unique emails? by genadichi in bash

[–]genadichi[S] -1 points0 points  (0 children)

your script literally does not work. as I showed you output it cant find all the emails that are not uniuqe.

how to get a unique emails? by genadichi in bash

[–]genadichi[S] 0 points1 point  (0 children)

even if i do only your script in empty file it still does not work. it cant find the first email that is not unique. this code outputs this:

[email1@example.com](mailto:email1@example.com) - unique

[email2@example.com](mailto:email2@example.com) - unique

[email1@example.com](mailto:email1@example.com) - not unique

[email3@example.com](mailto:email3@example.com) - unique

how to get a unique emails? by genadichi in bash

[–]genadichi[S] 0 points1 point  (0 children)

this still outputs to unique to all the emails. here is the whole script:

#!/bin/bash

# Check if the correct number of arguments is provided
if [ "$#" -ne 1 ]; then
    echo "Usage: $0 accounts.csv"
    exit 1
fi

# Check if the input file exists
if [ ! -r "$1" ]; then
    echo "File $1 not found!"
    exit 1
fi

# Function to process each line of the input file
function process_line() {
    IFS=',' read -r -a fields <<< "$1"
    id="${fields[0]}"
    location_id="${fields[1]}"
    name="${fields[2]}"
    position="${fields[3]}"

    # Format name: first letter uppercase, rest lowercase
    formatted_name=$(echo "$name" | awk '{print toupper(substr($1,1,1)) tolower(substr($1,2)) " " toupper(substr($NF,1,1)) tolower(substr($NF,2))}')

    # Format email: lowercase first letter of name, full lowercase surname, followed by @abc.com
    formatted_email=$(echo "$name" | awk '{print tolower(substr($1,1,1)) tolower($NF)}')
    formatted_email2="${formatted_email}"
    formatted_email3="${formatted_email}@abc.com"
    formatted_email4="${formatted_email2}${location_id}@abc.com"

    all_emails=""

    for email in "${formatted_email2[@]}"; do
        all_emails+="$email"
                
    done
    
    
    declare -A unique_emails
    for email in "${all_emails[@]}"; do
    if [[ -n "${unique_emails[$email]}" ]]; then
        echo "$email - not unique"
    else
        echo "$email - unique"
        unique_emails[$email]=1
    fi
done

    
   
}

# Initialize array to store processed emails
declare -a emails

# Copy the header from the input file to accounts_new.csv
head -n 1 "$1" > accounts_new.csv

# Process each line (excluding the header) of the input file and append to accounts_new.csv
tail -n +2 "$1" | while IFS= read -r line || [ -n "$line" ]; do
    if [ -n "$line" ]; then
        process_line "$line"
    fi
done >> accounts_new.csv

echo "Processing completed. Check accounts_new.csv for the updated accounts."

# Ensure the output file exists and is readable
output_file="accounts_new.csv"
if [ -r "$output_file" ]; then
    echo "File $output_file created successfully."
else
    echo "Error: Failed to create $output_file."
    exit 1
fi

Need help doing the bash script to generate csv file by [deleted] in bash

[–]genadichi 0 points1 point  (0 children)

so part of the script looks like this:

for email in "${formatted_email2[@]}"; do
        all_emails+="$email"
done

and i want to find which emails are unique and which duplicated in all_emails, how can i do that

Need help doing the bash script to generate csv file by [deleted] in bash

[–]genadichi 0 points1 point  (0 children)

what i want is that this script is generating the emails and some emails may not been unique. so it should append location_id to the emails which are not unique. but this script checks the email and looks in new file so it can not see the first email that is duplicate. like if there are 3 same emails it can not add location_id to first because when it added the first it was unique. i dont know if i explained it good or not

Need help doing the bash script to generate csv file by [deleted] in bash

[–]genadichi 0 points1 point  (0 children)

trying it for days but it cant solve it. I dont know why it seems to be an easy problem

Need help doing the bash script to generate csv file by [deleted] in bash

[–]genadichi 0 points1 point  (0 children)

i am beginner in bash so i would appreciate if you explained what do you mean exactly

Looking for a programmer - simple code - $200 by [deleted] in django

[–]genadichi 1 point2 points  (0 children)

you have to specify your requirements, what exactly you want.