rename multi files


 
Thread Tools Search this Thread
Operating Systems Solaris rename multi files
# 1  
Old 01-15-2008
rename multi files

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
# 2  
Old 01-15-2008
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
# 3  
Old 01-15-2008
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
# 4  
Old 01-15-2008
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
# 5  
Old 01-16-2008
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
# 6  
Old 01-16-2008
Quote:
Originally Posted by murad.jaber
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
# 7  
Old 01-16-2008
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SBATCH trinity for multiple files and rename/move the output files

Hey guys, I have wrote the following script to apply a module named "trinity" on my files. (it takes two input files and spit a trinity.fasta as output) #!/bin/bash -l #SBATCH -p node #SBATCH -A <projectID> #SBATCH -n 16 #SBATCH -t 7-00:00:00 #SBATCH --mem=128GB #SBATCH --mail-type=ALL... (1 Reply)
Discussion started by: @man
1 Replies

2. Shell Programming and Scripting

XML Splitting into multi files

Hi , I have a XML file like below file name : sample.xml <?xml version="1.0"?> <catalog> <author>Rajini</author> <title>XML Guide</title> <Text> </Text> <genre>Computer</genre> <price>44.95</price> </catalog> <?xml version="1.0"?> <catalog> ... (5 Replies)
Discussion started by: karthinvk
5 Replies

3. Shell Programming and Scripting

Script to unzip files and Rename the Output-files

Hi all, I have a many folders with zipped files in them. The zipped files are txt files from different folders. The txt files have the same names. If i try to find . -type f -name "*.zip" -exec cp -R {} /myhome/ZIP \; it fails since the ZIP files from different folders have the same names and... (2 Replies)
Discussion started by: pmkenya
2 Replies

4. Shell Programming and Scripting

How to zip or rm the multi part named files?

Hello There, There are more than 1000 files in my log folder and i want to zip it to relase the space. But my method throwing syntax error due to the multi part file name, how to overcome in this ? ls -lart | grep "MDB_Kernel11.1_gwlog_SUN 22_09_2013" | awk '{print $9,$10,$11,$12}' | head... (8 Replies)
Discussion started by: gowthamakanthan
8 Replies

5. Shell Programming and Scripting

How to substract selective values in multi row, multi column file (using awk or sed?)

Hi, I have a problem where I need to make this input: nameRow1a,text1a,text2a,floatValue1a,FloatValue2a,...,floatValue140a nameRow1b,text1b,text2b,floatValue1b,FloatValue2b,...,floatValue140b look like this output: nameRow1a,text1b,text2a,(floatValue1a - floatValue1b),(floatValue2a -... (4 Replies)
Discussion started by: nricardo
4 Replies

6. Shell Programming and Scripting

rename files Ax based on strings found in files Bx

Hi, I'm not very experienced in shell scripting and that's probably why I came across the following problem: I do have several hundred pairs of text files (PF00x.spl and PF00x.shd) where the first file (PF00x.spl) needs to be renamed according a string that is included in the second file... (12 Replies)
Discussion started by: inCH
12 Replies

7. UNIX for Dummies Questions & Answers

How to Delete Multi Directory and Files

I have a subdirectory which has many child directories and files in it. How can i delete them through a list (txt, rtf. xls , or any file extension) which is created by me. I can not manual delete one by one because it almost over 300 directory and over 4000 files. Any one know please help me? (5 Replies)
Discussion started by: cthinh
5 Replies

8. UNIX for Dummies Questions & Answers

multi part compressed files

Hi there, not sure if I am in the right place but here is my question. I have a file that is over 100mb and my host does not allow FTP of files above 100mb so I thought I would use a compression utility to compress it into smaller parts say 10mb each, upload them and then re-assemble them on... (7 Replies)
Discussion started by: gffb
7 Replies

9. Shell Programming and Scripting

How to send the multi files as a attachment

Hi all, Could you please guide me to write the shell script, to send a multi file as a attachement . Thanks Murugesh (1 Reply)
Discussion started by: Murugesh
1 Replies

10. Shell Programming and Scripting

join cols from multi files into one file

Hi Fields in Files 1,2,3,4 are pipe"|" separated. Say I want to grep col1 from File1 col3 from File2 col4 from File3 and print to File4 in the following order: col3|col1|col4 what is the best way of doing this? Thanks (2 Replies)
Discussion started by: vbshuru
2 Replies
Login or Register to Ask a Question