Sponsored Content
Top Forums Shell Programming and Scripting Problem renaming files using variables Post 302782161 by franzpizzo on Monday 18th of March 2013 11:01:22 AM
Old 03-18-2013
Hi, the error is the nested loops: try this way
Code:
END=4
for ((i=1;i<=END;i++))
do 
N=`sed -n ${i}p variable.txt`
mv ${i}.txt ${N}.txt
done

This User Gave Thanks to franzpizzo For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

advanced file renaming problem

I know this is probably a question for the newbie forum, where it is also posted, but I thought maybe some of you pros might like to help me out anyway. Here is my problem: I have to rename a batch of files that look like: 2001_0001.asc 2001_0002.asc . 2001_0548.asc 2002_0184.asc . .... (0 Replies)
Discussion started by: sea krait
0 Replies

2. UNIX for Advanced & Expert Users

problem with renaming files

Hi, I need to rename all the .txt files present in current directory to .dat files respectively in UNIX. for example: $ ls aaa.txt bbb.txt ccc.txt I need to change them to $ ls aaa.dat bbb.dat ccc.dat Is there any UNIX command to do this in one go? ... (3 Replies)
Discussion started by: Johny001
3 Replies

3. UNIX for Advanced & Expert Users

Renaming Multiple Files that have variables in the name

I am trying to rename multiple files from lower case to upper case, but then I need to change the word SHIP to Ship and CSV to csv. This is a sample of the input file name input_file_ship_1234_20110106.csv I need this to look like this INPUT_FILE_Ship_1234_20110106.csv this is the result when I... (3 Replies)
Discussion started by: cventura
3 Replies

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

5. Shell Programming and Scripting

Problem with renaming and saving

Hello mates, I am quite new to script programming and I am facing an uphill task to rename files in one folder. I have gone through similar posts but most of them deal with renaming files by changing the file extensions. Problem : I have a folder which contains files like... (5 Replies)
Discussion started by: chirag.joshi
5 Replies

6. Shell Programming and Scripting

File renaming problem

Can someone tell me how can i remove the RPCFTP word from RPCFTPfilelist.csv file ? (4 Replies)
Discussion started by: JSKOBS
4 Replies

7. Shell Programming and Scripting

Loop renaming files w/ a count problem

:wall: Hello there, basically in my program where im stuck at is when it comes to rename the files in a loop. - the program counts the number of files w a given name (works!) - and then if the number of files is greater or equal to the MAX_VERSIONS (numbers of files allowed w the... (1 Reply)
Discussion started by: thurft
1 Replies

8. UNIX for Advanced & Expert Users

Problem with renaming files

I have about 1000 files containing the character * in the name. I need to find these files and replace the * with a -. I am working with HP UX v11. I am using the following command find . -type f -name '*\**' -exec bash -c 'f="$1"; mv "$f" "${f//\*/-}"' - '{}' \ People tell me it works for... (4 Replies)
Discussion started by: MikeDavid
4 Replies

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

10. Shell Programming and Scripting

Problem renaming files on Solaris 10 server

Good day all. I'm trying to rename some files in my home directory with some bizarre results. Basically I need to change the IP address in the filename to the hostname which I ggrep from within the file: -rw-r--r-- 1 bh694n nrc 5095 May 2 20:03 alarms_999.189.161.146.log... (2 Replies)
Discussion started by: BRH
2 Replies
libapache2-mod-perl2-2.0.7::docs::api::ModPerl::Global(3User Contributed Perl Documentalibapache2-mod-perl2-2.0.7::docs::api::ModPerl::Global(3pm)

NAME
ModPerl::Global -- Perl API for manipulating special Perl lists Synopsis use ModPerl::Global (); my $package = 'MyApache2::Package'; # make the END blocks of this package special ModPerl::Global::special_list_register(END => $package); # Execute all encoutered END blocks from this package now ModPerl::Global::special_list_call( END => $package); # delete the list of END blocks ModPerl::Global::special_list_clear( END => $package); Description "ModPerl::Global" provides an API to manipulate special perl lists. At the moment only the "END" blocks list is supported. This API allows you to change the normal Perl behavior, and execute special lists when you need to. For example "ModPerl::RegistryCooker" uses it to run "END" blocks in the scripts at the end of each request. Before loading a module containing package $package, you need to register it, so the special blocks will be intercepted by mod_perl and not given to Perl. "special_list_register" does that. Later on when you want to execute the special blocks, "special_list_call" should be called. Unless you want to call the list more than once, clear the list with "special_list_clear". API
"ModPerl::Global" provides the following methods: "special_list_call" Call the special list $ok = special_list_call($key => $package); arg1: $key ( string ) The name of the special list. At the moment only 'END' is supported. arg2: $package ( string ) what package to special list is for ret: $ok ( boolean ) true value if $key is known, false otherwise. since: 2.0.00 "special_list_clear" Clear the special list $ok = special_list_clear($key => $package); arg1: $key ( string ) The name of the special list. At the moment only 'END' is supported. arg2: $package ( string ) what package to special list is for ret: $ok ( boolean ) true value if $key is known, false otherwise. since: 2.0.00 "special_list_register" Register the special list $ok = special_list_call($key => $package); arg1: $key ( string ) The name of the special list. At the moment only 'END' is supported. arg2: $package ( string ) what package to special list is for ret: $ok ( boolean ) true value if $key is known, false otherwise. since: 2.0.00 Notice that you need to register the package before it is loaded. If you register it after, Perl has already compiled the "END" blocks and there are no longer under your control. See Also mod_perl 2.0 documentation. Copyright mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0. Authors The mod_perl development team and numerous contributors. perl v5.14.2 2011-02-08 libapache2-mod-perl2-2.0.7::docs::api::ModPerl::Global(3pm)
All times are GMT -4. The time now is 07:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy