SOBA11009_1_1.xml
SOBA11009_1_2.xml
SOBA11009_1_3.xml
SOBA11009_1_4.xml
SOBA11009_1_5.xml
SOBA11009_2_1.xml
SOBA11009_2_1.xml
SOBA11009_2_2.xml
SOBA11009_2_3.xml
SOBA11009_3_1.xml
SOBA11009_3_2.xml
SOBA11009_3_3.xml


978-0-387-98595-4

Is it possible that I want to create a batch file that overwrites the SOBA1109 with
978-0-387-98595-4?

output:

978-0-387-98595-4_1_1.xml
978-0-387-98595-4_1_2.xml
978-0-387-98595-4_1_3.xml
978-0-387-98595-4_1_4.xml
978-0-387-98595-4_1_5.xml
978-0-387-98595-4_2_1.xml
978-0-387-98595-4_2_1.xml
978-0-387-98595-4_2_2.xml
978-0-387-98595-4_2_3.xml
978-0-387-98595-4_3_1.xml
978-0-387-98595-4_3_2.xml
978-0-387-98595-4_3_3.xml

Recommended Answers

All 4 Replies

1

Hello gian!

There are lots of ways to do what you're looking for. Perhaps the simplest way, when the pattern you need to replace is so consistent, is to use the 'sed' command.

In your script you could replace that part of the filename with something like this:

echo SOBA11009_1_1.xml |sed 's/SOBA11009/978-0-387-98595-4/'

I hope this helps!

it didnt work sir. i think its in OS that i'm using. im using windows7

I'm sorry for the delay. I'm not sure how one would accomplish this in Windows. there may be something you could do in PowerShell or VB, but I'm not very familiar with either of those.

Somebody else may be able to help, but in the "shell scripting" forum, you're mostly going to find folks with Unix/Linux shell scripting in mind. You might try posting something over in the Visual Basic or Microsoft Windows forums.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.