d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Help With Bash > Touch
Add Reply New Topic New Poll
Member
Posts: 1,640
Joined: Dec 14 2010
Gold: 0.50
Dec 2 2017 12:33pm
Hey guys,

I need to create 900 files with different 3 letter names.

Example: xyz.txt, where x, y and z are letters a to z.

Thank you very much!
Member
Posts: 108
Joined: Jan 24 2009
Gold: 373.85
Dec 2 2017 04:50pm
If the files don't need to use any particular set of letters:

Code
touch {a..b}{a..r}{a..y}.txt


If you need to go through the letters exhaustively, right-to-left:

Code
touch a{a..z}{a..z}.txt
touch b{a..h}{a..z}.txt
touch bi{a..p}.txt

Those are curly braces, by the way. They look like triangles on my screen.


This post was edited by YCX on Dec 2 2017 05:02pm
Member
Posts: 1,640
Joined: Dec 14 2010
Gold: 0.50
Dec 10 2017 08:35pm
Thanks for the reply!

I've figured out this solution:

printf '%s.txt\n' {a..z}{a..z}{a..z} | grep -vE '(.).?\1.?\.' \
| head -n 900 | xargs touch

This post was edited by VSTN619 on Dec 10 2017 08:35pm
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll