Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How can I rename multiple files depending on a string occuring in the filenames? Post 302118331 by radoulov on Monday 21st of May 2007 10:57:43 AM
Old 05-21-2007
With zsh:

Code:
$ autoload -U zmv
$ touch 123inputstringABC ABCinputstring123
$ ls -l *string*
-rw-r--r-- 1 Administrator None 0 May 21 16:53 123inputstringABC
-rw-r--r-- 1 Administrator None 0 May 21 16:53 ABCinputstring123
$ zmv '(*)inputstring(*)' '${1}newstring${2}'
$ ls -l *string*
-rw-r--r-- 1 Administrator None 0 May 21 16:53 123newstringABC
-rw-r--r-- 1 Administrator None 0 May 21 16:53 ABCnewstring123

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to backup multiple files and amend their filenames

Hi, I'm trying to write a command that backs up certain files into my current directory and adds a prefix to the backed up file name. I realise this can be done in a script by specifying each individual file but would like to know if it can be done on one line and made an alias. I have the... (5 Replies)
Discussion started by: m223464
5 Replies

2. Shell Programming and Scripting

Split file into multiple files depending upon first 4 digits

Hi All, I have a file like below: 1016D"ddd","343","1299" 1016D"ddd","3564","1299" 1016D"ddd","3297","1393" 1016D"ddd","32989","1527" 1016D"ddd","346498","1652" 2312D"ddd","3269","1652" 2312D"ddd","328","1652" 2312D"ddd","2224","2100" 3444D"ddd","252","2100" 3444D"ddd","2619","2100"... (4 Replies)
Discussion started by: deepakgang
4 Replies

3. Shell Programming and Scripting

extract multiple cloumns from multiple files; skip rows and include filenames; awk

Hello, I am trying to write a bash shell script that does the following: 1.Finds all *.txt files within my directory of interest 2. reads each of the files (25 files) one by one (tab-delimited format and have the same data format) 3. skips the first 10 rows of the file 4. extracts and... (4 Replies)
Discussion started by: manishabh
4 Replies

4. Shell Programming and Scripting

write to multiple files depending on file type (solved)

I want a script that will add comments to a file before check-in files. comments depend on type of files. i have a script to list files in the directory that will be checked-in There are xml, js, html, vm files. vm will use comments like c/c++ ( // or /*..*/) can you help me add a comment line... (0 Replies)
Discussion started by: pradeepmacha
0 Replies

5. UNIX for Dummies Questions & Answers

Rename Multiple Files

Hey guys, I am the definition of a newbie. I am in the process of trying to rip all my dvds onto a new HTPC I setup. While doing this, I am also trying to organize a bunch of other files I already have to proper naming conventions. So far I have just been naming each file separately (I am on a... (4 Replies)
Discussion started by: Ralze34
4 Replies

6. Shell Programming and Scripting

How to rename multiple files at one go?

Hi, I have hundreds of files with XXX in their file name and I want to rename all of them with YYY in place of XXX. for ex: $ ls -1 123XXX789 345XXX678 Output $ ls -1 123YYY789 345YYY678 I know we can loop in each file and sed to replace and rename each file but ren *XXX* *YYY*... (4 Replies)
Discussion started by: reddyr
4 Replies

7. UNIX for Dummies Questions & Answers

Is there any way to cat multiple files and show filenames?

Hi, Is there any way to do a cat * where it shows the name of each file in the process? Similar to what more does below? $ more ?.sql :::::::::::::: 1.sql :::::::::::::: set linesize 200 select db_unique_name, cast( from_tz( cast(... (5 Replies)
Discussion started by: newbie_01
5 Replies

8. Shell Programming and Scripting

There are multiple filenames in the directory.How to return the the lastest files for each file name

there are mutiple file nams in the directory. How to return the the lastest files for each file name. ex. abc1234_050201 abc1234_050206 abc1234_050208 xyz34_050204 xyz34_050210 xyz34_050218 thanks (4 Replies)
Discussion started by: grand_sam
4 Replies

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

10. Shell Programming and Scripting

Rename multiple files in one go

OS : Oracle Linux 6.8 shell : bash As shown below, I have multiple files like below (query1-extract_aa, query1-extract_ab, query1-extract_ac, ....) $ ls -l total 235680 -rw-rw-r-- 1 reportusr reportusr 30M May 3 11:25 query1-extract_aa -rw-rw-r-- 1 reportusr reportusr 30M May 3 11:25... (5 Replies)
Discussion started by: kraljic
5 Replies
rndc(1M)                                                  System Administration Commands                                                  rndc(1M)

NAME
rndc - name server control utility SYNOPSIS
rndc [-V] [-c config-file] [-k key-file] [-s server] [-p port] [-y key_id] command DESCRIPTION
The rndc utility controls the operation of a name server. It supersedes the ndc utility that was provided in previous BIND releases. If rndc is invoked with no command line options or arguments, it prints a short summary of the supported commands and the available options and their arguments. The rndc utility communicates with the name server over a TCP connection, sending commands authenticated with digital signatures. The only supported authentication algorithm in the current versions of rndc and named(1M) is HMAC-MD5, which uses a shared secret on each end of the connection. This algorithm provides TSIG-style authentication for the command request and the name server's response. All commands sent over the channel must be signed by a key_id known to the server. The rndc utility reads a configuration file to determine how to contact the name server and decide what algorithm and key it should use. OPTIONS
The following options are supported: -c config-file Use config-file as the configuration file instead of the default /etc/rndc.conf. -k key-file Use key-file as the key file instead of the default, /etc/rndc.key. The key in /etc/rndc.key is used to authenticate com- mands sent to the server if the config-file does not exist. -s server The server argument is the name or address of the server that matches a server statement in the configuration file for rndc. If no server is supplied on the command line, the host named by the default-server clause in the option statement of the configuration file is used. -p port Send commands to TCP port port instead of BIND 9's default control channel port, 953. -V Enable verbose logging. -y keyid Use the key keyid from the configuration file. The keyid argument must be known by named with the same algorithm and secret string for control message validation to succeed. If no keyid is specified, rndc will first look for a key clause in the server statement of the server being used, or if no server statement is present for that host, then the default-key clause of the options statement. The configuration file contains shared secrets that are used to send authenticated control com- mands to name servers. It should therefore not have general read or write access. For the complete set of commands supported by rndc, see the BIND 9 Administrator Reference Manual or run rndc without arguments to see its help message. LIMITATIONS
The rndc utility does not support all the commands of the BIND 8 ndc utility. There is no way to provide the shared secret for a key_id without using the configuration file. Several error messages could be clearer. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |Availability |SUNWbind9 | |Interface Stability |External | +-----------------------------+-----------------------------+ SEE ALSO
named(1M), named.conf(4), rndc.conf(4), attributes(5) BIND 9 Administrator Reference Manual NOTES
Source for BIND9 is available in the SUNWbind9S package. SunOS 5.10 15 Dec 2004 rndc(1M)
All times are GMT -4. The time now is 08:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy