If I have a word called "orange," how to divide it into separate characters.
My conclusion should be:
o r a n g e
echo orange | fold -w 1
Output
Here is a solution with grep :
grep
echo "orange" | grep -o .
Here is a solution using sed:
echo orange | sed 's/./&\n/g'
A pure bash solution (faster than calling external tools on short lines):
$ a="orange" $ [[ $a =~ ${a//?/(.)} ]] && printf '%s\n' "${BASH_REMATCH[@]:1}" o r a n g e
Source: https://habr.com/ru/post/1437495/More articles:Rewriting a path for a specific file using htaccess - url-rewritingChanges in many ways - entity-frameworkWriting to stderr in x86 assembly - assemblyEmberjs: redirect to last state when user used router - redirectConvert Spring Update Mongo to JSON String - javaUsing Hive for real-time queries - mysqlThe returned substring, starting from the position after the end of the line (C ++) - c ++Compare types in Scala - scalaWhat is the complexity of the std :: string :: substr member function? - c ++Multiple Images BackgroundRepeat - cssAll Articles