Search code examples
bashawkvlcplaylistcat

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


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


Solution

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