I need to rename all the files in the current directory,if it contains specific letters using shell programming.
For that I used
foreach file
if (`grep $2 $file`) then
mv "$file" newname;
in $2 the specific characters are stored.
How should I modify this code?
Are there any simple way to do that?
I am using cygwin in windows xp
diddle
0
Newbie Poster
Recommended Answers
Jump to PostYou need to give us exactly what you are doing. Your expected input, expected output.
The code as written will trash every file it works on except that last one, ie. dozens of files may become newname. How do you want the new name to be?
All 2 Replies
Reply to this topic
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.