вы можете использовать команду grep , на странице руководства вы найдете:
grep searches for PATTERN in each FILE. A FILE of “-” stands for standard input. If no FILE is given, recursive searches examine the working directory, and nonrecursive searches read standard input. By default, grep prints the matching lines.
-o, --only-matching Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
-e PATTERN, --regexp=PATTERN Use PATTERN as the pattern. If this option is used multiple times or is combined with the -f (--file) option, search for all patterns given. This option can be used to protect a pattern beginning with “-”.
на ваш вопрос:
echo 'select {{112,department}},{{112,client}},{{112,place}} from table where id=1 and {{112,cgid}} and {{113,evid}}' | grep -o -e "{\{2\}[^{]*}\{2\}"
{\{2\}
означает, что символ { встречается ровно два раза. [^{]*
означает любые символы в любое время, кроме { . }\{2\}
означает, что } символов встречается ровно два раза. результат будет:
{{112,department}}
{{112,client}}
{{112,place}}
{{112,cgid}}
{{113,evid}}
Если вы хотите использовать псевдоним, это решит вашу проблему:
компакт-диск
vim.bashrc
#Внизу добавьте следующую строку#
псевдоним ls='ls -ls --color=auto'
#сохранить и выйти
источник.bashrc
то "ls" всегда будет отображаться в списке и сортироваться.