Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 679
John Avatar asked Jan 29 '26 15:01

John


1 Answers

xargs -a avis.txt -I {} vlc --playlist-enqueue {}
like image 51
Dennis Williamson Avatar answered Feb 01 '26 14:02

Dennis Williamson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!