Sponsored Content
Full Discussion: move in ksh
Top Forums Shell Programming and Scripting move in ksh Post 302257594 by mqasim on Wednesday 12th of November 2008 03:15:11 PM
Old 11-12-2008
move in ksh

Hello everybody:

I wanted to rename some files by adding date at the end. I wanted to assign the new name to a variable. Following is the code

REMOTE_FILE="/abc/data/test.csv"

mv /abc/data/test.csv /abc/data/"`date '+test_%Y%m%d'`".csv

REMOTE_FILE="/abc/data/"`date '+test_%Y%m%d'`".csv"


Question:
1. Is the above code correct? The expected result would be 'test_20081112.csv'
2. There are multiple files e.g. test1.csv, test2.csv, test3.csv; I believe I have to use loop as following but not sure.

for each in *.csv;
do
mv $each /abc/data/"`date '+test_%Y%m%d'`".csv
done


I would appreciate any help.
Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

import var and function from ksh script to another ksh script

Ih all, i have multiples ksh scripts for crontab's unix jobs they all have same variables declarations and some similar functions i would have a only single script file to declare my variables, like: var1= "aaa" var2= "bbb" var3= "ccc" ... function ab { ...} function bc { ... }... (2 Replies)
Discussion started by: wolfhurt
2 Replies

2. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

3. UNIX for Dummies Questions & Answers

Difference Between executing llike ./myscript.ksh and . ./myscript.ksh

Hi , What is the diffence between executing the script like ./myscript.ksh . ./myscript.ksh I have found 2 difference but could not find the reason 1. If i export a variable in myscript.ksh and execute it like . ./myscript.ksh the i can access the other scripts that are present in... (5 Replies)
Discussion started by: max_hammer
5 Replies

4. Shell Programming and Scripting

different behaviour for ksh and ksh -x

I'm getting different behaviour when executing below script in debug option. $ cat ss.ksh ff=$(pwd) echo " ff : $ff" $ ksh ss.ksh ff : /tmp $ ksh -x ss.ksh + + pwd ff= + echo ff : ff : I was getting this behaviour in my actuall script i'm able to reproduce this in simple script... (4 Replies)
Discussion started by: luckybalaji
4 Replies

5. AIX

Move LV to a different PV (same VG)

Hi guys, I need some assistance moving a LV. :D I have a VG with two PV; on the second PV there is only one LV so I want to move it to the first PV (hdisk1) in order to get rid of the second one (hdisk2) Something like (pseudocode): move MyLV from hdisk2 to hdisk1 How can I achieve that? (4 Replies)
Discussion started by: verdepollo
4 Replies

6. Shell Programming and Scripting

Find and move

Hello All, /storage3 /storage4 I have written a shell script to locate files older than 7 days in /storage4 folder and move to /storage3.At the same time it will take output as number of files moved and log in a .txt file. It will also find files in /storage3 older than 90 days and remove... (4 Replies)
Discussion started by: Siddheshk
4 Replies

7. AIX

Move directory

Hi All, please help me with the command for moving/copying one directory(including subdirectories) to one directory in another mount point in same server in AIX ... thanksss (7 Replies)
Discussion started by: Sanal
7 Replies

8. Shell Programming and Scripting

find command to move the files to other folder - ksh 88

Hi , I've learnt that the following command will remove the files from the given folder for given no.of days find /home/etc -type f -atime -10 -exec rm -f {} \; But how can I change the above command that will move the files to another specified directory instead of removing the... (1 Reply)
Discussion started by: smile689
1 Replies

9. AIX

Move data LV

hello everyone, this is my first post in this forum, I hope I am in the right place :) I am relatively new to AIX, and I need help doing the following: move data from directory /universe_log/CIHPRD to /universe_log/novabch1 while changing lv and preserving mount point. below some... (7 Replies)
Discussion started by: Tarik36
7 Replies

10. UNIX for Beginners Questions & Answers

Check for files and move it to another directory - ksh

I'm trying to wirte ksh script for given requirement, but i unable to achive it. In dir1 directory I need to check for the files which suffixed with .csv or .txt, If there is no files, then i need to exit. If any files found I need to move the each file found to dir2 directory. I have to repeat... (4 Replies)
Discussion started by: Kayal
4 Replies
REC2CSV(1)							   User Commands							REC2CSV(1)

NAME
rec2csv - rec to csv converter SYNOPSIS
rec2csv [OPTIONS]... [REC_FILE] DESCRIPTION
Convert rec data into csv data. -t, --type=TYPE record set to convert to csv; if this parameter is omitted then the default record set is used -S, --sort=FIELD sort the output by the specified field. --help print a help message and exit. --version show version and exit. AUTHOR
Written by Jose E. Marchesi. REPORTING BUGS
Report bugs to: bug-recutils@gnu.org GNU recutils home page: <http://www.gnu.org/software/recutils/> General help using GNU software: <http://www.gnu.org/gethelp/> COPYRIGHT
Copyright (C) 2010, 2011, 2012 Jose E. Marchesi. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for rec2csv is maintained as a Texinfo manual. If the info and rec2csv programs are properly installed at your site, the command info rec2csv should give you access to the complete manual. rec2csv 1.4.93 January 2012 REC2CSV(1)
All times are GMT -4. The time now is 02:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy