Howto enqueue all files listed in a file to a vlc

2019-07-03 16:05发布

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

2条回答
放荡不羁爱自由
2楼-- · 2019-07-03 16:44
xargs -a avis.txt -I {} vlc --playlist-enqueue {}
查看更多
爷的心禁止访问
3楼-- · 2019-07-03 16:52
cat avis.txt | awk '{print "vlc --playlist-enqueue "$0}' > updatedFile.txt
查看更多
登录 后发表回答