我想使用 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)
请建议更好的方法来做到这一点,最好在一行中。
寻找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)