Sponsored Content
Top Forums Shell Programming and Scripting Parameter file with changing date Post 302829021 by RavinderSingh13 on Wednesday 3rd of July 2013 08:46:08 PM
Old 07-03-2013
Hello,

Could you please try the following code.


Code:
 
a=`date '+%y:%m:%d' | awk -F":" '{printf"20%2d%2d%2d\n",$1,$2,($3)}' | sed 's/ /0/g'`

#echo $a

tmpfile=abcdefgh_$a
#echo ${tmpfile}
cd /home/singh/awk_prog*
 
if [[ -e ${tmpfile} ]]
then
mailx -s "file exists" Ravinder_Singh1@test.com
else
mailx -s "file does NOT exists" Ravinder_Singh1@test.com
fi


Note: # is used for commenting the lines/codes. Please try this hopw trhis will help you.


Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Changing Creation Date to a Prespecified Date of a File In Unix

Dear Expert, Is there a command to do that in Unix? In such a way that we don't need to actually "write" or modified the content. -- monkfan (4 Replies)
Discussion started by: monkfan
4 Replies

2. Shell Programming and Scripting

copying a file without changing date stamp.

Hi, I am using the below copy command, to copy the file sbn to sbn1, cp sbn sbn1 but its changing the date stamp of file sbn1, but i dont want to change the date stamp of sbn1. Could you please help me out in this. (3 Replies)
Discussion started by: shivanete
3 Replies

3. UNIX for Dummies Questions & Answers

send output of a file as input for changing date

Hi, Please help me out on this one. I want to send the output of a file as input for changing the date using date command. Example, i have a file date.txt whose contents are 081014462009 I need to use the date in that file as input for date command. I tried cat date.txt | date ; but it... (2 Replies)
Discussion started by: foxtron
2 Replies

4. IP Networking

Changing network parameter in Existing OS image

Hi , Can some one tell me , is there a way to change the existing network parameter in existing OS image , or do i have to create a new image to have new network parameters . (0 Replies)
Discussion started by: thana
0 Replies

5. UNIX for Dummies Questions & Answers

Repeating a column but changing one parameter

Does anyone know how I can create a file like this: blue 0 red 0 yellow 0 green 0 orange 0 blue 2 red 2 yellow 2 green 2 orange 2 blue 4 red 4 yellow 4 green 4 orange 4 blue 6 red 6 (5 Replies)
Discussion started by: cosmologist
5 Replies

6. Shell Programming and Scripting

Command for changing date format in a file

Hi... I have an inputfile name as :- abc_test_20120213.dat (date in yyyymmdd format) I need the output file name as abc_test_13022012.dat (date in ddmmyyyy format) Please help me on this... Thanks in advance. (5 Replies)
Discussion started by: gani_85
5 Replies

7. Shell Programming and Scripting

changing date to resemble "messages file" date

the following was taken from a perl script: my $date = strftime "%B %d %H:%M:%S", localtime; how can i modify it so this date outputs the date in the form of the date of the messages file. for example: Sep 20 11:48:44 As it is right now, the perl script outputs the date like this: ... (1 Reply)
Discussion started by: SkySmart
1 Replies

8. Shell Programming and Scripting

Changing date format in CSV file

I have a CSV file with a date format like this; 11/19/2012 17:37:00,1.372,121.6 11/19/2012 17:38:00,0.743,121.6 Want to change the time stamp to seconds after 1970 so I can get the data in rrdtool. For anyone interested, this is data from a TED5000 unit and is Kwatts and volts. Needs to... (3 Replies)
Discussion started by: ottsm
3 Replies

9. Shell Programming and Scripting

Changing the nth parameter in a file

Hello, I use a program using an input stream of parameters: ./my_prog.out <parameters.txt The parameters.txt file has the following structure: name date number1 number2 system now imagine i would like to execute several times (>200) this program, but with different sets of number1... (2 Replies)
Discussion started by: shamsfield
2 Replies

10. UNIX for Beginners Questions & Answers

How to replace a parameter(variable) date value inside a text files daily with current date?

Hello All, we what we call a parameter file (.txt) where my application read dynamic values when the job is triggered, one of such values are below: abc.txt ------------------ line1 line2 line3 $$EDWS_DATE_INSERT=08-27-2019 line4 $$EDWS_PREV_DATE_INSERT=08-26-2019 I am trying to... (1 Reply)
Discussion started by: pradeepp
1 Replies
explain_tmpfile_or_die(3)				     Library Functions Manual					 explain_tmpfile_or_die(3)

NAME
explain_tmpfile_or_die - create a temporary file and report errors SYNOPSIS
#include <libexplain/tmpfile.h> FILE *explain_tmpfile_or_die(void); FILE *explain_tmpfile_on_error(void); DESCRIPTION
The explain_tmpfile_or_die function is used to call the tmpfile(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_tmpfile(3) function, and then the process terminates by calling exit(EXIT_FAILURE). The explain_tmpfile_on_error function is used to call the tmpfile(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_tmpfile(3) function, but still returns to the caller. RETURN VALUE
The explain_tmpfile_or_die function only returns on success, see tmpfile(3) for more information. On failure, prints an explanation and exits, it does not return. The explain_tmpfile_on_error function always returns the value return by the wrapped tmpfile(3) system call. EXAMPLE
The explain_tmpfile_or_die function is intended to be used in a fashion similar to the following example: FILE *result = explain_tmpfile_or_die(); SEE ALSO
tmpfile(3) create a temporary file explain_tmpfile(3) explain tmpfile(3) errors exit(2) terminate the calling process COPYRIGHT
libexplain version 0.52 Copyright (C) 2009 Peter Miller explain_tmpfile_or_die(3)
All times are GMT -4. The time now is 08:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy