Remove the First Capital Letter from Each Element

Sort by

recency

|

169 Discussions

|

  • + 0 comments

    My solution: #!/bin/bash

    array=()

    while read -r entrada; do array+=("$entrada") done

    echo ${array[@]/[a-zA-Z]/.}

  • + 0 comments
    #!/bin/bash
    readarray myarray
    
    for (( i=0; i<${#myarray[@]}; i++ ));
    do
        echo .${myarray[i]:1:${#myarray[i]}} | tr "\n" " "
    done
    
  • + 0 comments

    !/bin/bash

    replace_char_at_position() { local cadena="2" local nuevo_caracter="{cadena:0:posicion}{cadena:((posicion + 1))} " } count=() aux=() while read n do count+=({count[@]}; do replace_char_at_position {aux[@]}"

  • + 0 comments

    !/bin/bash

    Declare an array to hold the country names

    countries=()

    Read countries from input (one per line)

    while IFS= read -r line; do countries+=("$line") done

    Initialize an array for transformed names

    transformed=()

    Loop through each country name in the array

    for country in "You can't use 'macro parameter character #' in math mode{country/[A-Z]/.}" transformed+=("$transformed_name") done

    Join the transformed names with a space and print the result

    echo "${transformed[*]}"

  • + 0 comments

    Very easy first replacement then adding seperator and put in one line:

    sed "s/([A-Z])/./1" | paste -s -d " "