LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 02:47 PM   #1
triciasurfer
LQ Newbie
 
Registered: Oct 2015
Posts: 9

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
-----


I’d like the list to be in a simple plaintext file.

Thank you.
 
Old 10-12-2015, 03:53 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
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, 03:58 PM   #3
triciasurfer
LQ Newbie
 
Registered: Oct 2015
Posts: 9

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, 12:52 AM   #4
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
^ W-O-W.
thanks for sharing.
 
  


Reply



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-10-2013 11:18 PM
[SOLVED] AMD A8-3850 (Series A-Series APU Socket FM1) processor for new Linux computer ssenuta Linux - Hardware 12 11-15-2012 04:51 AM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 04:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:27 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
Open Source Consulting | Domain Registration