Howto enqueue all files listed in a file to a vlc playlist using cat and awk

こ雲淡風輕ζ 提交于 2019-12-12 14:22:35

问题


I'm trying to enqueue all files listed in a textfile to a VLC playlist. Every line holds an absolute path to a movie file.

Adding just one file to the playlist works perfectly:

vlc --playlist-enqueue someMediaFile

I'm also able to execute a command (e.g. print) for every line listed in the textfile using cat and awk like this:

cat avis.txt | awk '{print $0}'

...

But combined, it doesn't work:

cat avis.txt | awk '{vlc --playlist-enqueue $0}'

The line above prints the content of the file avis.txt line by line to the standard output while awk reads the data from there line by line using a pipe. awk will also replace $0 with the 'n' line from the file. So every command, executed by awk, will look like this, i thought:

vlc --playlist-enqueue firstLineFromAvis.txt
vlc --playlist-enqueue secondLineFromAvis.txt
...
vlc --playlist-enqueue nLineFromAvis.txt

But that's not happening. Could someone tell me what am I doing wrong? Can't I execute a programm with parameters using awk like that?

Thanks for reading.

John


回答1:


cat avis.txt | awk '{print "vlc --playlist-enqueue "$0}' > updatedFile.txt



回答2:


xargs -a avis.txt -I {} vlc --playlist-enqueue {}


来源:https://stackoverflow.com/questions/12151318/howto-enqueue-all-files-listed-in-a-file-to-a-vlc-playlist-using-cat-and-awk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!