Jump to content


Photo

Copy a line to a text file incrementing a number within the line


  • Please log in to reply
3 replies to this topic

#1 kalehrl

  • Senior Member
  • 468 posts

+8
Neutral

Posted 29 August 2020 - 07:08

I have a line which I need to copy to a text file 250 times incrementing a number within the line. The line is this:

https://xxxxx-1.b.xxxxx.com/xxx/djset/xxxxx-0001.mp4

I need the number 0001 to be incremented by 1 in each consecutive line so that I would get a file with lines like this:

https://xxxxx-1.b.xxxxx.com/xxx/djset/xxxxx-0001.mp4
https://xxxxx-1.b.xxxxx.com/xxx/djset/xxxxx-0002.mp4
https://xxxxx-1.b.xxxxx.com/xxx/djset/xxxxx-0003.mp4
https://xxxxx-1.b.xxxxx.com/xxx/djset/xxxxx-0004.mp4

I can add a line to a file with echo command:

echo "xxxxx-1.b.xxxxx.com/xxx/djset/xxxxx-0001.mp4" >> file.txt

But I need a command which will add 250 of these lines and increment the number in them.

 

Thank you.

 



Re: Copy a line to a text file incrementing a number within the line #2 40H3X

  • Forum Moderator
    PLi® Contributor
  • 5,790 posts

+186
Excellent

Posted 29 August 2020 - 08:00

Go have a look at http://www.mynikko.c...crementstr.html


Hardware: Vu+ Uno 4K SE - Vu+ Duo 4K  - Fuba 78 cm - Tripleblock LNB Quad 19.2/23.5/28.2 - DS918+
Software : OpenPLi - OSCam - Settings van Hans - Autotimer - EPGImport

---------------------------------------------------------------------------------------------------------------------------------------

Remember: Upvote with the rep_up.png button for any user/post you find to be helpful, informative, or deserving of recognition!

---------------------------------------------------------------------------------------------------------------------------------------

Many answers to your question can be found in our new and improved wiki

Note: I do not provide support via PM !.


Re: Copy a line to a text file incrementing a number within the line #3 kalehrl

  • Senior Member
  • 468 posts

+8
Neutral

Posted 29 August 2020 - 09:31

Worked a treat!

Thanks.



Re: Copy a line to a text file incrementing a number within the line #4 40H3X

  • Forum Moderator
    PLi® Contributor
  • 5,790 posts

+186
Excellent

Posted 29 August 2020 - 13:39

Good to hear  ;)


Hardware: Vu+ Uno 4K SE - Vu+ Duo 4K  - Fuba 78 cm - Tripleblock LNB Quad 19.2/23.5/28.2 - DS918+
Software : OpenPLi - OSCam - Settings van Hans - Autotimer - EPGImport

---------------------------------------------------------------------------------------------------------------------------------------

Remember: Upvote with the rep_up.png button for any user/post you find to be helpful, informative, or deserving of recognition!

---------------------------------------------------------------------------------------------------------------------------------------

Many answers to your question can be found in our new and improved wiki

Note: I do not provide support via PM !.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users