LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-12-2015, 03:47 PM   #1
triciasurfer
LQ Newbie
 
Registered: Oct 2015
Posts: 2

Rep: Reputation: Disabled
How can I get computer to auto-complete this series/list?


How can I get my computer to complete this list?


foo/booster/tang_1.xyz

foo/booster/tang_1a.xyz

...

foo/booster/tang_1h.xyz
foo/booster/tang_2.xyz
foo/booster/tang_2a.xyz
foo/booster/tang_2b.xyz
foo/booster/tang_2h.xyz
foo/booster/tang_3.xyz
...

foo/booster/tang_150h.xyz.



----
As you can see, there are two variables:

The number (from 1 to 150)
What comes after the number, which is either some letter from a to h (e.g. tang_1c.xyz) or nothing (e.g. tang_1.xyz).


What stays the same is everything else:
1. the "foo/booster/tang_" part
2. the ".xyz" part
-----


Id like the list to be in a simple plaintext file.

Thank you.
 
Old 10-12-2015, 04:53 PM   #2
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,606

Rep: Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977
what does the list look like before the auto-completion?
do you want to change existing entries, or do you want the script to multiply the string "foo/booster/tang_.xyz" with given additions?
always fro a to h, always from 1 to 150?
seems you're looking at 2 loops inside of each other, the outer from 1 to 150, the inner from a to h.

do you want to do this is in bash?
actually, whichever (scripting) language you choose, show us what you got, we will help you make it better.
 
Old 10-12-2015, 04:58 PM   #3
triciasurfer
LQ Newbie
 
Registered: Oct 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
Solution

I found the answer:

Code:
printf '%s\n' foo/booster/tang_{1..150}{,{a..h}}.xyz > somefile
 
1 members found this post helpful.
Old 10-13-2015, 01:52 AM   #4
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,606

Rep: Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977
^ W-O-W.
thanks for sharing.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Complete guide for sources.list and mirror.list Zepiroth Ubuntu 8 07-11-2013 12:18 AM
[SOLVED] AMD A8-3850 (Series A-Series APU Socket FM1) processor for new Linux computer ssenuta Linux - Hardware 12 11-15-2012 05:51 AM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 05:51 PM


All times are GMT -5. The time now is 10:06 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration