- http://www.perlmonks.org/?node_id=940559
-
perl -le '$_=1;print,s/(\d+) ?/+$1 $1/g,s/\S+/$&/eeg until$a++>15' perl -le '$_=o;print,s/./$&$&/g,s/(?!^)(.)(.)/$1^$2^_/eg until$a++>80'
- 去掉文件名首的 .
-
for i in `ls .[a-zA-Z1-9]*`; do mv -v $i ${i:1}; done
- 从视频文件里提取某个片段
-
从 $in-file 拷贝 begin-time 到 begin-time+duration 时间断内的视频,视频和音频拷贝,丢掉字幕 ffmpeg -i $in-file -ss begind-time[00:04:09] -t duration[00:05:00] -vcodec copy -acodec copy -sn $out-file
- mplayer 循环播放歌曲
-
mplayer music-file -loop $times : $times 播放次数, 0 则无限循环
- 使用 ffmpeg 对视频截图
-
ffmpeg -i INPUT-FILE -y -f image2 -ss 5 -s 352x240 -vframes 1 OUTPUT.jpg ffmpeg -i INPUT-File -y -f image2 -ss 5 -t 0.001 -s 352x240 OUTPUT.jpg
- mplayer get screenshot
-
mplayer -ss START_TIME -nosound -vo png -frames NUMBER -vf "scale=HEIGHT:WIDTH" SOURCE_FILE
- 去掉最后一行
-
sed -i '$d' file
- 指定 ip 访问域名
-
curl -v -l -H 'Host:example.org' http://xxx.xxx.xxx.xxx/path/to/request curl -vx xxx.xxx.xxx.xxx:80 http://example.org/path/to/request wget http://xxx.xxx.xxx.xxx/path/to/request --header='host:example.org'
- mplayer 字幕在视频图片的下方
-
# 全屏时字幕下移 mpalyer -subcp srt-encode -sub srt-file-name -vo gl file-name # 图像上移 mpalyer -subcp srt-encode -sub srt-file-name -vf expand=0:-80:0:0 file-name
- 使用不同格式的字幕
-
# 繁体字幕 mplayer -subcp big5 -sub file-name.cht.srt film-file-name mplayer -subcp gb18030 -sub file-name.cht.srt film-file-name # 简体字幕 mplayer -subcp gb2312 -sub file-name.cht.srt film-file-name mplayer -subcp cp936 -sub file-name.cht.srt film-file-name
- show specific line # show 4075th of file perl -lne 'print, exit if $. == 4075' file.txt sed -n '4075p' file.txt awk 'NR==4075' file.txt
Hey! The above document had some coding errors, which are explained below:
- Around line 7:
-
=over without closing =back