xargs 默认是单线程执行,如果要使用多线程并行执行, 需要 -P N
参数, 其中N是期望使用的线程数.
xargs -n 指定有标准输入传递进来的最大参数数量. 通常使用 -n 1
xargs -I {} 输入的参数的替代字符串, 可以用于指定输入参数在目标执行命令中的位置. 如 cat words.txt | xargs -n1 -I{} grep {} file.txt
xargs 默认是单线程执行,如果要使用多线程并行执行, 需要 -P N
参数, 其中N是期望使用的线程数.
xargs -n 指定有标准输入传递进来的最大参数数量. 通常使用 -n 1
xargs -I {} 输入的参数的替代字符串, 可以用于指定输入参数在目标执行命令中的位置. 如 cat words.txt | xargs -n1 -I{} grep {} file.txt
while read aline;
do
echo $aline
some code....
done < targetFile.log
read 是系统自带的文件读取操作.
使用 clementine 播放 ape 格式 (ffmpeg parsed ape)音乐时 遇到一个问题: Your GStreamer installation is missing a plug-in.
在一篇文章看到安装 ffmpeg plugin 的方法:
sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install gstreamer0.10-ffmpeg
npm adduser
的时候输入已经注册的用户名和密码即可通过验证.npm publish
即可完成发布. 注意命名不要冲突了.dependencies
are installed on both:
npm install from a directory that contains package.json
npm install $package on any other directory
process.versions.v8
使用 sed 将一行中的特定部分切出来. extract substring by pattern. regex
cat xxxxx |grep xxxx | sed -n 's/REGEX_FULLLINE/\1/p'
例:
echo "regular expression - extract part of string using sed" |sed -n 's/.*- extract \(.*\) using.*/\1/p'
'use strict'; | |
// use node-debug to run client.js and observe the memory useage. | |
var http = require('http'); | |
var keepAliveAgent = new http.Agent({keepAlive: true, maxSockets: 500}); | |
var list = []; | |
for (var i = 0; i < 500; i++) { | |
list.push("hello world"); | |
} |
{
if(FNR==NR) { # first file
map[$1]=1
} else { # second file
if ($1 in map) {
} else {
print $1
}
}
function Person(){ | |
this.name = 'anonymous' | |
} | |
Person.prototype.toJSON = function toJSON(){ | |
return 'Person ' + this.name; | |
}; | |
Person.prototype.pro01 = 'yes'; |