Get part of a string of part of regular expression?
Posted
by Buttink
on Stack Overflow
See other posts from Stack Overflow
or by Buttink
Published on 2010-03-28T22:32:08Z
Indexed on
2010/03/28
23:03 UTC
Read the original article
Hit count: 172
shell
Im trying to make a script that will go into a directory and run my own application with each file matching a regular expression, specifically "Test[0-9]*.txt".
My input filenames look like this "TestXX.txt". Now, I could just use cut and chop off the Test and .txt, but how would I do this if XX wasn't predefined to be 2 numbers? What would I do if i had "Test1.txt" ... "Test10.txt"? In other words, How would I get the [0-9]* part?
Just so you know, I want to be able to make a OutputXX.txt :)
© Stack Overflow or respective owner