在macbook上使用AWK做文件记账
我对 mac 有点陌生unix 环境.. 我正在尝试管理我的 itunes 库文件,这些文件目前非常混乱。
具体来说,我的一些专辑被翻录了两次——一次是 m4a,一次是 mp3。不幸的是,这意味着我在 iTunes 中有重复的内容。我想删除 mp3,但保留 m4a。并非所有专辑都有 m4a,因此我无法批量删除 mp3。
我的想法是使用 awk 搜索同时包含 m4a 和 mp3 的目录,然后仅删除这些目录中的 mp3。
有什么帮助吗?谢谢!
I'm kind of new to the mac & unix environment.. I'm trying to manage my itunes library files, which are pretty mixed up at the moment.
Specifically some of my albums were ripped twice - once in m4a, and once in mp3. Unfortunately, that means I have duplicates in iTunes. I want to delete the mp3's, but keep the m4a's. Not all albums have m4a's, so I can't do a mass delete of mp3's.
My thought is to use awk to search through the directories which have both m4a's and mp3's, and then delete the mp3's only in those directories.
Any help? thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不需要 AWK。以下命令使用
find
查找所有 m4a 文件并将它们提供给 shell 命令。 shell 命令用“mp3”代替文件名末尾的“m4a”,检查以确保 mp3 文件存在,然后将其删除。要在实际使用之前进行尝试,请将
rm
更改为echo
。You don't need AWK. The following command uses
find
to find all the m4a files and feeds them to a shell command. The shell command substitutes "mp3" in place of the "m4a" at the end of the filename, checks to make sure the mp3 file exists, then deletes it.To try it out before you use it live, change the
rm
toecho
.如果它适合您,请删除
echo
Remove the
echo
if it works for you