dear all
i have about 5142 file begin with (package jordba."packagename")
i want to remove the package .jordba without touch the package name
i need to stay the package name only
can any body help me
thanx
dear all
i have about 5142 file begin with (package jordba."packagename")
i want to remove the package .jordba without touch the package name
i need to stay the package name only
can any body help me
thanx
say you have files like below...
jordba.package1
jordba.package2
jordba.package3
use the below:
for f in jordba.*; do mv "$f" "${f#jordba.}"; done
the above for loop will make your list like...
package1
package2
package3
hope this answers!
-ilan
thank you it work
but there is another issue similar to the before that i have the files
x1_p.sql
x2_p.sql
x3_p.sql
and so on
i need to add h before .sql to be as the following:
x1_ph.sql
x2_ph.sql
x3_ph.sql
This should work for the data given by you above...
for f in *_p.sql ; do mv "$f" "${f%_p.sql}_ph.sql"; done
-ilan
thank you mr ilan but finally i want to replcae word with another word in multi files in multi directories as following
i want to replace jordba by paldba in all files under the directories
packages,procedures,cursors
thank you for your coorporation
use this...
sed -e 's/jordba/paldba/g' -i *.txt
-ilan
okay but how can i run this command on the files which exist in multi directories bye one command and not enter each directory and run the sed command
can find command do and what option must i enter
thank you
the sed command not work it give me the error below
sed: illegal option -- i
i removed i option then run the command sed and it also not success
kindly help
-i option is part of GNU sed
not available with versions of SED in Solaris
you won't be able to do inplace replacements
may be you should try
sed 's/search/pattern/g' filename > out.filename
mv out.filename filename
#!/bin/sh
find /users/home/yhlee/ -type f -name "*_p.sql" | while read line
do
newfile=`echo "$line" | sed 's/_p/_ph/g'`
mv "$line" "$newfile"
done
~