Reputation: 199
How can I allow on the following regex the uppercase letters?
Regex is perfectly fine, but it will also rename it if there is uppercase letters on it and I want to allow it.
renamed_file="$(echo "$filename" | sed -e 's/[A-Z]/\L&/g' -e 's/[^a-z0-9]/_/g')"
Upvotes: 0
Views: 78
Reputation: 4043
Modify your regex in sed
as followed,
sed -e 's/[^A-Za-z0-9]/_/g'
In this way, any character that doesn't match to A-Za-z0-9
would be converted to _
Upvotes: 1