我的变量> riak_kv_crdt:map_value(O1).
** exception error: no function clause matching
riak_object:get_contents({riakc_obj,
{<<"test_map">>,<<"uinfo_log">>},
<<"ahmed_info_1">>,
<<107,206,97,96,96,96,204,96,202,5,82,60,7,47,197,115,
158,125,191,80,29,34,148,200,...>>,
[{{dict,3,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],...},
{{[],[],[],[],[],[],[],[],[],[],[...],...}}},
<<69,2,0,0,0,11,114,105,97,107,95,100,116,95,109,97,
112,77,2,131,...>>}],
undefined,undefined}) (src/riak_object.erl, line 595)
in function riak_kv_crdt:merge_object/1 (src/riak_kv_crdt.erl, line 186)
in call from riak_kv_crdt:value/2 (src/riak_kv_crdt.erl, line 98)
in call from riak_kv_crdt:map_value/1 (src/riak_kv_crdt.erl, line 140)
包含以下内容:
$var
我需要删除重复的单词,结果必须存储在同一变量var=word1,word2,word3,word1,word3
中。
答案 0 :(得分:1)
尝试
var="word1,word2,word3,word1,word3"
list=$(echo $var | tr "," "\n")
var=($(printf "%s\n" "${list[@]}" | sort | uniq -c | sort -rnk1 | awk '{ print $2 }'))
echo "${var[@]}"
答案 1 :(得分:0)
如果对perl
开放,则:
$ var="word1,word2,word3,word1,word3"
$ var=$(perl -F, -lane'{$h{$_}++ or push @a, $_ for @F; print join ",", @a}' <<< "$var")
$ echo "$var"
word1,word2,word3