We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Remove the First Capital Letter from Each Element
Remove the First Capital Letter from Each Element
Sort by
recency
|
169 Discussions
|
Please Login in order to post a comment
My solution: #!/bin/bash
array=()
while read -r entrada; do array+=("$entrada") done
echo ${array[@]/[a-zA-Z]/.}
!/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[@]}"
!/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 "{country/[A-Z]/.}" transformed+=("$transformed_name") done
Join the transformed names with a space and print the result
echo "${transformed[*]}"
Very easy first replacement then adding seperator and put in one line:
sed "s/([A-Z])/./1" | paste -s -d " "