我的文件名称要更改。
示例:
Nashville.2012.SXXEXX.W.ac3
How.To.Get.Away.With.Murder.SXXEXX.W.ac3
Better.Call.Saul.SXXEXX.W.ac3
Beauty.And.The.Beast.2012.SXXEXX.W.ac3
Hawaii.Five.0.2010.SXXEXX.W.ac3
我需要转换它们:
echo Nashville2012SXXEXXW.ac3 | sed 's/[A-Z]/.&/g;s/^.//'
Nashville2012.SXX.EXX.W.ac3
echo HowToGetAwayWithMurderSXXEXXW.ac3 | sed 's/[A-Z]/.&/g;s/^.//'
How.To.Get.Away.With.Murder.SXX.EXX.W.ac3
我发现了这个:
this.login = function (username, password, rememberMe) {
if (rememberMe === undefined) rememberMe = false;
return $http.post(
'/j_spring_security_check',
$.param({
j_username: username,
j_password: password,
j_remember: rememberMe
}),
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(_.bind(function (response) {
if (response.data.success === true) {
//something to happen on login
}
return $q.reject(response);
}, this));
};
this.logout = function () {
$http.get('/j_spring_security_logout').then(_.bind(function () {
//something to happen on logout
}, this));
};
如果无法更改文件名,我会自己打电话给他们。我只是想知道这是否有可能找到一种方法,但如果它过于复杂我会花费,因为其余的脚本工作:)
答案 0 :(得分:2)
使用GNU sed:
sed -r 's/([A-Z][^A-Z.]+)/\1./g;s/[0-9]{4}/.&/g;s/([0-9])([0-9]{4})[^$]/\1.\2./;s/SXXEXXW/SXXEXX.W/;s/(S[0-9][0-9])\./\1/'
示例:
$ echo Nashville2012SXXEXXW.ac3 | sed -r 's/([A-Z][^A-Z.]+)/\1./g;s/[0-9]{4}/.&/g;s/([0-9])([0-9]{4})[^$]/\1.\2./;s/SXXEXXW/SXXEXX.W/;s/(S[0-9][0-9])\./\1/'
Nashville.2012.SXXEXX.W.ac3
$ echo HowToGetAwayWithMurderSXXEXXW.ac3 | sed -r 's/([A-Z][^A-Z.]+)/\1./g;s/[0-9]{4}/.&/g;s/([0-9])([0-9]{4})[^$]/\1.\2./;s/SXXEXXW/SXXEXX.W/;s/(S[0-9][0-9])\./\1/'
How.To.Get.Away.With.Murder.SXXEXX.W.ac3
$ echo HawaiiFive02010S03E08W.ac3 | sed -r 's/([A-Z][^A-Z.]+)/\1./g;s/[0-9]{4}/.&/g;s/([0-9])([0-9]{4})[^$]/\1.\2./;s/SXXEXXW/SXXEXX.W/;s/(S[0-9][0-9])\./\1/'
Hawaii.Five.0.2010.S03E08.W.ac3