您好,我正在寻找解决此问题的方法。我有一个输出,我使用uniq -c
排序。代码看起来像这样find $DIR -type f | file -b $files | sort -n | uniq -c | sort -nr
有人能告诉我用什么方式可以访问前缀中数字的值吗? 我的输出是什么样子:搜索和计数匹配行
21 ASCII text
19 C source, ASCII text
16 ASCII text
10 ASCII text, with very long lines
9 HTML document, UTF-8 Unicode text, with
2 HTML document, ASCII text, with very lon
1 C source, UTF-8 Unicode text
Exprected输出:
ASCII text : 21
C source, ASCII text : 19
ASCII text : 16
ASCII text, with very long lines : 10
HTML document, UTF-8 Unicode text, with : 9
HTML document, ASCII text, with very lon : 2
C source, UTF-8 Unicode text : 1
我怎样才能在文件类型前值保存到一个变量?
请发布示例数据和预期输出。 –
*将文件类型之前的值保存到变量中* - 您的变量在哪里? – RomanPerekhrest