LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-05-2015, 11:04 AM   #1
ziphem
Member
 
Registered: Feb 2004
Location: US / EU
Distribution: Fedora 31
Posts: 223

Rep: Reputation: 29
youtube-dl and removing lines after processing?


I have the following command:

Code:
#!/bin/bash
name=$(cat "/home/mydir/URLs.txt")
echo
echo $name
echo
youtube-dl -o /home/mydir/downloads/youtube-dl/'%(title)s'.flv -x --audio-format mp3 --audio-quality 320 -k --embed-subs $name
etc.

I'm looking for a way to remove each line in $name after it is successfully processed. I didn't see something like that as a function of a youtube-dl switch, so I'm wondering how I can do this in bash?

Would it work to follow the youtube-dl command with
Code:
&& $name | sed -e '1d'
But even if this works, it doesn't necessarily verify the file correctly downloaded. I'd greatly appreciate any feedback on this.

Thanks!!
 
Old 12-05-2015, 03:09 PM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
you can read the file with the urls into an array, then iterate over that array.

bash arrays are worth the learning curve.

http://mywiki.wooledge.org/BashGuide/Arrays
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Linux Bash - Processing Lines from Text Nexusfactor Linux - General 4 01-16-2015 12:59 AM
Removing all but last 5 lines p1xty Programming 3 11-03-2011 05:53 AM
Removing new lines from a file psandeepnair1985 Programming 5 03-25-2007 11:46 AM
rpm hangs while reading/processing headers after a forced removing of files hamtavs Linux - Software 0 08-25-2004 02:14 PM
Removing lines from file Aylar Programming 2 04-22-2004 06:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration