Sponsored Content
Full Discussion: Renaming files - error
Top Forums UNIX for Beginners Questions & Answers Renaming files - error Post 303029671 by nag_sathi on Wednesday 30th of January 2019 11:27:05 AM
Old 01-30-2019
Thanks Rudic.


It working perfectly.Can you explain the below code.


Code:
 t=${i/"file"/"newfile"}

--- Post updated at 12:27 PM ---

Hi Don,


Apologies for delay message. My request is simple and below shown and rudic code worked.


i/p


Code:
atomic@atomic-VirtualBox:~/Shell_Practice/rename$ ls -lrt
total 8
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 file2.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 file1.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 file3.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 file4.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 file6.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 file5.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 file7.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 file8.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 file9.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 file10.txt
-rwxr-xr-- 1 atomic atomic 117 Jan 26 22:08 rename.sh
-rwxr-xr-- 1 atomic atomic 125 Jan 30 21:36 myrename.sh


output


Code:
atomic@atomic-VirtualBox:~/Shell_Practice/rename$ ls -lrt
total 8
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 newfile2.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 newfile1.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 newfile3.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 newfile4.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 newfile6.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 newfile5.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 newfile7.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 newfile8.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 newfile9.txt
-rw-r--r-- 1 atomic atomic   0 Jan 25 22:55 newfile10.txt
-rwxr-xr-- 1 atomic atomic 117 Jan 26 22:08 rename.sh
-rwxr-xr-- 1 atomic atomic 121 Jan 30 21:38 myrename.sh

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Renaming files

hi, I have the following files as below. reg_test_123232 reg_test_125654 reg_test_473843 How do I rename reg_test_123232 to abc_123232 and the rest of file by just keeping the numeric field ? Please advise :) (3 Replies)
Discussion started by: cedrichiu
3 Replies

2. UNIX for Dummies Questions & Answers

renaming files

I have a list of files named ab_*.csv I would like to remane them all by removing the ab_ and have *.csv I did the following but I am surely missing something. /* wrong script */ for i in `ls -1 ab_*`; do mv ab_$i $i; done Thanks in advance. (1 Reply)
Discussion started by: jxh461
1 Replies

3. Shell Programming and Scripting

Renaming Files

Hi Alll, I have a script that we use on the servers to change the name of files that have spaces in the name: #!/bin/tcsh set n = 0 foreach f ( * ) echo $f | grep " " if ( $? == 0 ) then mv "$f" `echo $f | sed -e "s/ /_/g"` @ n += 1 endif end echo $n changed I need to write a... (2 Replies)
Discussion started by: abch624
2 Replies

4. Shell Programming and Scripting

Getting error by renaming all the files in a folder

Hi All, I have a folder name as postscript folder and it contains the following postscript files. package1.ps package2.ps package3.ps when i am renaming all the ps files to xps files by using the following command mv /postscript/*.ps /postscript/*.xps Then i am getting the... (4 Replies)
Discussion started by: sunitachoudhury
4 Replies

5. UNIX for Dummies Questions & Answers

Need help renaming files

I just can't figure this one out. I have a lot of files name (for example) ABC1234.5678.ext I need to rename these files U0105678PQRS So I'm removing everything before the first "." I'm keeping "5678" in the file name Adding "U010" to the front of "5678" Dropping the ".ext" extension ... (5 Replies)
Discussion started by: bbbngowc
5 Replies

6. Shell Programming and Scripting

renaming files

Hello, I wanted to rename one file where filename contains space.. How can i rename in unix? The file name is ABC XYZ.TXT I wanted to rename this file as ABCXYZ.TXT. Any help is greatly appreciated... Regards. (4 Replies)
Discussion started by: govindts
4 Replies

7. Shell Programming and Scripting

renaming files or adding a name in the beginning of all files in a folder

Hi All I have a folder that contains hundreds of file with a names 3.msa 4.msa 21.msa 6.msa 345.msa 456.msa 98.msa ... ... ... I need rename each of this file by adding "core_" in the begiining of each file such as core_3.msa core_4.msa core_21.msa (4 Replies)
Discussion started by: Lucky Ali
4 Replies

8. UNIX for Dummies Questions & Answers

Renaming Files With 2 .

Dear All expertise.. just wanna ask if there is a way on how to change the filename as per below sample:- filename:- cob120514093156.03.466926330 CCBS-CPMM_SEND_COB_120514_100549_3.rpt to convert to:- cob120514093156.03.466926330.bd (rename from cob120514093156.03.466926330) ... (17 Replies)
Discussion started by: yokomo
17 Replies

9. Shell Programming and Scripting

renaming files

Hi, I have a list of files in a folder with the same name ending (over 1000 files) joe.jpy.jpeg joe1.jpy.jpeg joe2.jpy.jpeg jon3.jpy.jpeg jor5.jpy.jpeg .....jpy.jpeg etc. I want to change jpy to hhk So the output will be: joe.hhk.jpeg joe1.hhk.jpeg joe2.hhk.jpeg jon3.hhk.jpeg... (3 Replies)
Discussion started by: kylle345
3 Replies

10. Shell Programming and Scripting

Renaming multiple files in sftp server in a get files script

Hi, In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this? I am using #!/bin/ksh For eg: sftp user@host <<EOF cd /path get *.txt rename *.txt *.txt.done ... (7 Replies)
Discussion started by: jhilmil
7 Replies
rmm(1)							      General Commands Manual							    rmm(1)

NAME
rmm - remove messages (only available within the message handling system, mh) SYNOPSIS
rmm [+folder] [msgs] [-help] OPTIONS
Prints a list of the valid options to this command. The default settings for this command are: +folder defaults to the current folder msgs defaults to the current message DESCRIPTION
The rmm command deletes the current message from the current folder. You can specify messages and folders other than the current ones by using the +folder and msgs arguments. The current message is not changed by rmm, so a next will advance to the next message in the folder as expected. If you have defined a component rmmproc: in your file, then instead of simply renaming the message file, rmm will call the named program to delete the file. The rmm command removes messages by renaming the message files with a preceding comma. Many sites consider files that start with a comma to be a temporary backup, and arrange for cron(8) to remove such files once a day. PROFILE COMPONENTS
Path: To determine your Mail directory rmmproc: Program to delete the message FILES
The user profile. SEE ALSO
rmf(1) rmm(1)
All times are GMT -4. The time now is 11:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy