使用 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'
使用 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'
process.versions.v8
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
使用 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
while read aline;
do
echo $aline
some code....
done < targetFile.log
read 是系统自带的文件读取操作.
xargs 默认是单线程执行,如果要使用多线程并行执行, 需要 -P N
参数, 其中N是期望使用的线程数.
xargs -n 指定有标准输入传递进来的最大参数数量. 通常使用 -n 1
xargs -I {} 输入的参数的替代字符串, 可以用于指定输入参数在目标执行命令中的位置. 如 cat words.txt | xargs -n1 -I{} grep {} file.txt
sudo apt-get install apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd John
/etc/nginx/.htpasswd 是保存用户验证信息的文件路径.sudo htpasswd -n Tom
在 STDOUT 会输出user:password 格式的信息, 将其追加到上一步生成的配置文件中即可. 注意不要反复使用 -c 参数反复创建文件. auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;