Sponsored Content
Full Discussion: Rename files in a format
Top Forums Shell Programming and Scripting Rename files in a format Post 302858339 by pravin27 on Monday 30th of September 2013 05:43:43 AM
Old 09-30-2013
Code:
 ls -1 | while read filename
do
newName=$(echo $filename | awk -F"[.]" 'NF==3{print $1"."$1"."$2"."$3"V00"}'); 
[ -n "$newName" ] && mv $filename $newName
newName=""
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to rename files?

:confused: How can i rename a file 'x.log' to 'x_20020512 072909.log' :eek: i'm using perl, with system command from a unix web server, and need to timestamp my logs if the above format (filename _ year month day hr min sec .log) (9 Replies)
Discussion started by: CompuTelSystem
9 Replies

2. Shell Programming and Scripting

rename files

hey all, I have files in the format of ABCD20061101 and ABCDEF20061101 in one directory, I would like to change all ABCD20061101 to ABCDEF20061101 and the problem is if I do a simple pattern match of ABCD, then those ABCDEF20061101 would also... (2 Replies)
Discussion started by: mpang_
2 Replies

3. Shell Programming and Scripting

Rename files

Hello, I've a list of file like this img_001 img_22 img_44 and I would rename all with this form photo_0001 photo_0002 photo_0003 photo_0004 suggestions?Thanks to all. (2 Replies)
Discussion started by: cv313x
2 Replies

4. 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

5. UNIX for Dummies Questions & Answers

Rename all .sh files to .pl

I have various .sh and .pl files in one directory. I want to rename all the .sh files to .pl i.e testscript.sh --> testscript.pl I am trying to use mv *.sh *.pl It doesnt work though!! (3 Replies)
Discussion started by: chrisjones
3 Replies

6. Shell Programming and Scripting

Need script for transferring bulk files from one format to text format

"Help Me" Need script for transferring bulk files from one format to text format in a unix server. Please suggest (2 Replies)
Discussion started by: Kranthi Kumar
2 Replies

7. UNIX for Dummies Questions & Answers

Rename all Files in a UNIX Directory from one date format to another date format

Hi Unix Gurus, I would like to rename several files in a Unix Directory . The filenames can have more than 1 underscore ( _ ) and the last underscore is always followed by a date in the format mmddyyyy. The Extension of the files can be .txt or .pdf or .xls etc and is case insensitive ie... (1 Reply)
Discussion started by: pchegoor
1 Replies

8. 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

9. Shell Programming and Scripting

Rename files

I am getting some files with this mask: aaaa_SP_bbb.txt aaaa_FX_bbbb.txt aaaabbbb.txt I want to rename the files containing: _SP_ -> Rename - >> fileSP.TXT _FX_ -> Rename - >> fileFX.txt and other file that does not contain these words rename them: filenamexx.txt as I... (4 Replies)
Discussion started by: Jomeaide
4 Replies

10. 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
pop3d::udb(n)						      Tcl POP3 Server Package						     pop3d::udb(n)

NAME
pop3d::udb - Simple user database for pop3d SYNOPSIS
package require Tcl 8.2 package require pop3d::udb ?1.0? ::pop3d::udb::new ?dbName? dbName option ?arg arg ...? dbName destroy dbName add user pwd storage dbName remove user dbName rename user newName dbName lookup user dbName exists user dbName who dbName save ?file? dbName read file DESCRIPTION
The package pop3d::udb provides simple in memory databases which can be used in conjunction with the pop3 server core provided by the pack- age pop3d. The databases will use the names of users as keys and associates passwords and storage references with them. Objects created by this package can be directly used in the authentication callback of pop3 servers following the same interface as servers created by the package pop3d. ::pop3d::udb::new ?dbName? This command creates a new database object with an associated global Tcl command whose name is dbName. The command dbName may be used to invoke various operations on the database. It has the following general form: dbName option ?arg arg ...? Option and the args determine the exact behavior of the command. The following commands are possible for database objects: dbName destroy Destroys the database object. dbName add user pwd storage Add a new user or changes the data of an existing user. Stores password and storage reference for the given user. dbName remove user Removes the specified user from the database. dbName rename user newName Changes the name of the specified user to newName. dbName lookup user Searches the database for the specified user and returns a two-element list containing the associated password and storage refer- ence, in this order. Throws an error if the user could not be found. This is the interface as expected by the authentication call- back of package pop3d. dbName exists user Returns true if the specified user is known to the database, else false. dbName who Returns a list of users known to the database. dbName save ?file? Saves the contents of the database into the given file. If the file is not specified the system will use the path last used in a call to dbName read. The generated file can be read by the read method. dbName read file Reads the specified file and adds the contained user definitions to the database. As the file is actually source'd a safe inter- preter is employed to safeguard against malicious code. This interpreter knows the add command for adding users and their associated data to this database. This command has the same argument signature as the method add. The path of the file is remembered internally so that it can be used in the next call of dbName save without an argument. KEYWORDS
pop3, internet, network, protocol, rfc1939 pop3d 1.0 pop3d::udb(n)
All times are GMT -4. The time now is 08:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy