小编Ami*_*and的帖子

从 Perl 中包含空或空白字符的数组中删除元素

我想使用 map 或 grep 将数组 @x 转换为数组 @y。

@x = ('aa','', 'bb','    ','cc', "\t");
@y = ('aa','bb','cc');
Run Code Online (Sandbox Code Playgroud)

我试过的:

#@x= grep {s/^\s+|\s+$//g} @x;  # not correct
@y = grep { $_ } @x;  # remove '' null character
Run Code Online (Sandbox Code Playgroud)

请建议更好的方法来做到这一点,最好在一行中。

perl grep dictionary

1
推荐指数
1
解决办法
859
查看次数

在solaris中递归搜索包含字符串的文件

寻找solaris命令获取包含搜索模式的所有文件的列表(递归).我知道如何为linux做这个,但同样的命令在solaris中不起作用:

bash-3.2# uname -a
SunOS D1NCIC-CL01 5.10 Generic_148888-03 sun4u sparc SUNW,Sun-Fire-15000

bash-3.2# find . -type f -print0 | xargs -0 grep -l "contentInFile"
xargs: illegal option -- 0
xargs: Usage: xargs: [-t] [-p] [-e[eofstr]] [-E eofstr] [-I replstr] [-i[replstr]] [-L #] [-l[#]] [-n # [-x]] [-s size] [cmd [args ...]]
find: bad option -print0
find: [-H | -L] path-list predicate-list
Run Code Online (Sandbox Code Playgroud)

recursion search solaris file

1
推荐指数
1
解决办法
2万
查看次数

标签 统计

dictionary ×1

file ×1

grep ×1

perl ×1

recursion ×1

search ×1

solaris ×1