capturing a file to store in a variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting capturing a file to store in a variable
# 1  
Old 07-21-2009
capturing a file to store in a variable

I have a file in a windows directory the file is delivery to us like this
07210900.dat
where
07210900 is the current date.
If I want to store that file in a variable UpLoadFileName and
rename, so I can Ftp later to a UNIX directory, I am doing this, is this correct?

Code:
CDRemoteDir='cd alumni\xxxx\xxx\0910\FTP'
UpLoadFileName=`date "+%m%d%y"00.dat`;
NewName= "eluppdtop.dat" ;

Thank you

Last edited by rechever; 07-21-2009 at 06:50 PM.. Reason: fixed code tag
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to store file name in a variable?

Hi All, Daily I am generating a file dfm_daily_file_ ex: dfm_daily_file_05072015 date will be changed daily. Once the file is FTP it is deleted. I have tried the below code to get the file name with any date and store it in a variable its not working. #!/bin/ksh ... (4 Replies)
Discussion started by: ROCK_PLSQL
4 Replies

2. Shell Programming and Scripting

How to read a value from a file and store in a variable?

Hi, I have a file service.xml which has following content: <?xml version="1.0" encoding="UTF-8"?> <Service Ver="2.31.13"/> I want to read the value of Ver (that is 2.31.13) and assign to a variable which i further use. Please help me in that. (3 Replies)
Discussion started by: laxmikant15
3 Replies

3. Shell Programming and Scripting

Extract a string from a file and store it in variable

Hi, I've a file ImageSizeDetails.txt with the following contents: Image Name: swncd 01.10.00.04 Created: Wed Jan 9 14:05:48 2013 Image Type: ARM Linux Multi-File Image (gzip compressed) Data Size: 7351011 Bytes = 7178.72 kB = 7.01 MB Load Address: 00008000 Entry Point: ... (6 Replies)
Discussion started by: Parameswaran
6 Replies

4. Shell Programming and Scripting

To store the file name o/p from find command in to a variable

Hi How to use a variable to store the filename of a file which was found by the 'find' command. can this be practical-->var = find . -name "filename.dat" Please help.. (1 Reply)
Discussion started by: ayyappaas
1 Replies

5. Shell Programming and Scripting

Read the contents of a file and store them in a variable

Hi Gurus, I am trying for a scenario where in I want to read the contents of a file line by line and then store them in variables. Below is the script: #!/bin/ksh while read line do id=`echo $line | cut -f1 -d |` name=`echo $line | cut -f2 -d |` echo $id ... (11 Replies)
Discussion started by: svajhala
11 Replies

6. UNIX for Dummies Questions & Answers

Read a file and store each value in a variable

Hi, How to read a file and put the values in a script. E.g. file1.txt 02/12/2009;t1;t2 The script should read this file and put these values in 3 different variables x1,x2,x3 which can be used further. Thanks Ashu (3 Replies)
Discussion started by: er_ashu
3 Replies

7. Shell Programming and Scripting

Capturing a number at the end of line and store it as variable

Hello, Would someone guide me on how to write a shell script the would search for a phone no using at the end text file using sed or awk and store it in a varaible or print it. The text file is in this form text or numbers in first line text or numbers in second line . . . Firsname... (6 Replies)
Discussion started by: amuthiga
6 Replies

8. Shell Programming and Scripting

store the first line of a file in a variable

i have to store the files in a folder and assign a variable to the the files. (0 Replies)
Discussion started by: dineshr85
0 Replies

9. UNIX for Dummies Questions & Answers

Capturing some data from a file into a variable

I have a file with some values in a tab delimted format Eg: 'test' contains: a<tab>b<tab>c<tab>Trk_12345678 now i need to capture this value 'Trk_12345678' into a variable say 'x' and append that value of 12345678 to 12345679 and store is back to a new 'test1' file as : 'test1'... (11 Replies)
Discussion started by: shiroh_1982
11 Replies

10. UNIX for Advanced & Expert Users

how to read each letter from file and store it in variable.

Dear friends, i am writing csh script i have one dat file containing following data.like this. 08FD3 03A26 000FA0 FFFF0 BBA0F 00000 00000 from the above file i want to read each letter and store it in one variable. how it is possible. please help (7 Replies)
Discussion started by: rajan_ka1
7 Replies
Login or Register to Ask a Question
explain_rename(3)					     Library Functions Manual						 explain_rename(3)

NAME
explain_rename - explain rename(2) errors SYNOPSIS
#include <libexplain/rename.h> const char *explain_rename(const char *oldpath, const char *newpath); const char *explain_errno_rename(int errnum, const char *oldpath, const char *newpath); void explain_message_rename(char *message, int message_size, const char *oldpath, const char *newpath); void explain_message_errno_rename(char *message, int message_size, int errnum, const char *oldpath, const char *newpath); DESCRIPTION
The functions declared in the <libexplain/rename.h> include file may be used to explain errors returned by the rename(2) system call. explain_rename const char *explain_rename(const char *oldpath, const char *newpath); The explain_rename function is used to obtain an explanation of an error returned by the rename(2) function. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (rename(oldpath, rewpath) < 0) { fprintf(stderr, "%s ", explain_rename(oldpath, newpath)); exit(EXIT_FAILURE); } oldpath The original oldpath, exactly as passed to the rename(2) system call. newpath The original newpath, exactly as passed to the rename(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_errno_rename const char *explain_errno_rename(int errnum, const char *oldpath, const char *newpath); The explain_errno_rename function is used to obtain an explanation of an error returned by the rename(2) function. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (rename(oldpath, newpath) < 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_rename(err, oldpath, newpath)); exit(EXIT_FAILURE); } errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. oldpath The original oldpath, exactly as passed to the rename(2) system call. newpath The original newpath, exactly as passed to the rename(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_message_rename void explain_message_rename(char *message, int message_size, const char *oldpath, const char *newpath); The explain_message_rename function is used to obtain an explanation of an error returned by the rename(2) function. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (rename(oldpath, newpath) < 0) { char message[3000]; explain_message_rename(message, sizeof(message), oldpath, newpath); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } message The location in which to store the returned message. Because a message return buffer has been supplied, this function is thread safe, if the buffer is thread safe. message_size The size in bytes of the location in which to store the returned message. oldpath The original oldpath, exactly as passed to the rename(2) system call. newpath The original newpath, exactly as passed to the rename(2) system call. explain_message_errno_rename void explain_message_errno_rename(char *message, int message_size, int errnum, const char *oldpath, const char *newpath); The explain_message_errno_rename function is used to obtain an explanation of an error returned by the rename(2) function. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (rename(oldpath, newpath) < 0) { int err = errno; char message[3000]; explain_message_errno_rename(message, sizeof(message), err, oldpath, newpath); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } message The location in which to store the returned message. Because a message return buffer has been supplied, this function is thread safe, given a thread safe buffer. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. oldpath The original oldpath, exactly as passed to the rename(2) system call. newpath The original newpath, exactly as passed to the rename(2) system call. COPYRIGHT
libexplain version 0.52 Copyright (C) 2008 Peter Miller AUTHOR
Written by Peter Miller <pmiller@opensource.org.au> explain_rename(3)