Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Rename files in bash via string handling' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Rename files in bash via string handling
Authored by: i5ao on Sep 07, '06 10:24:53AM
the hint above replaces by string character position, but you can also use simple pattern matching using slashes: ${variable_name/find/replace}
for f in abc-1.txt abc-2.txt abc-33.txt
  echo ${f/abc-/new name -> def_}

new name -> def_1.txt
new name -> def_2.txt
new name -> def_33.txt

[ Reply to This | # ]