Sponsored Content
Top Forums Shell Programming and Scripting Variable value not being fetched in the filename.. Post 302201172 by RRVARMA on Saturday 31st of May 2008 02:57:37 PM
Old 05-31-2008
Error Variable value not being fetched in the filename..

Hi,

In the code below, the $DD1, $DD2, $MM1, $MM2 are not fetching the values. Can anybody tell me where have i made wrong.

Shift_date.sh is a script which gives the previous date if we give the current date in the format YYYYMMDD and +/- how many days past/future.. Like Shift_date.sh 20080531 -2 gives an output as 20080529.

At last echo $DD1 is giving the correct value. But i need to get that in Pockets_$MM1-$DD1_to_$MM2-$DD2_data.txt..
Is it because of meta characters being used? Please Help..

Code:
#!/bin/ksh

currweekday=`date '+%u'`

currdate=`date '+%Y%m%d'`

((n1 = currweekday + 7))
((n2 = currweekday + 1))

DD1=$(ksh Shift_date.sh $currdate -$n1 | cut -c7-8)
MM1=$(ksh Shift_date.sh $currdate -$n1 | cut -c5-6)
DD2=$(ksh Shift_date.sh $currdate -$n2 | cut -c7-8) 
MM2=$(ksh Shift_date.sh $currdate -$n2 | cut -c5-6)

echo Pockets_$MM1-$DD1_to_$MM2-$DD2_data.txt

echo $DD1

Thanks,
RRVARMA
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

AWK Filename as variable

Need some help. I need to load data into some Oracle tables and one of the pieces of data that I need to load is the filename. This filename is distinct every single time. Basically the last 6 characters will be different with no pattern. ex. testfile_041504_003567 To load the filename... (4 Replies)
Discussion started by: firkus
4 Replies

2. Shell Programming and Scripting

mv Filename variable to another filename

Anyone who can assist : I am trying to pass the group vairiable to a filename: rpt_tsavegrp=/export/legato/scripts/$group_savegrp_rpt.$dat It will not pass to variable. Anyone have any ideas what I am doing wrong here. Thanks # This script sends email that save group completed.... (3 Replies)
Discussion started by: gzs553
3 Replies

3. Shell Programming and Scripting

variable used as filename

Hello, i'm fairly new to scripting, so please bear with me (I did try looking this up first, i figured it had to have been asked already). #!/bin/bash fileName=`date | sed -n 's/ /_/g p' | sed -n 's/^/Backup_/p' | sed -n 's/$/\.tar/p'`; #THIS SETS BACKUP_DATE echo $fileName #TEST OF VALUE ... (4 Replies)
Discussion started by: jzacsh
4 Replies

4. UNIX for Advanced & Expert Users

Issues while sending a mail having records fetched from SQL -all in UNIX

hi-I want to write a UNIX Script which will fetch records from Oracle database.I want to store these records in a file under fields like email address,name and the transaction_id and then fetch these records from the file and send the email to individual users with their transaction ID details. (4 Replies)
Discussion started by: DeepSalwan
4 Replies

5. UNIX for Dummies Questions & Answers

assingn a variable a filename and then reading it in

Im trying to set a filename to a variable and then read the file in using the variable but im getting a syntax error. any ideas? #!/bin/bash function scanFile() { while read $1 do echo $filename done } file1=report.log scanFile() $file1 (3 Replies)
Discussion started by: magnia
3 Replies

6. Shell Programming and Scripting

Inserting variable value into filename

Greetings, people of UNIX/Linux forums. I am having a problem with a script, where I am trying to create a new variable. The value of this variable would be dependent on the value in a couple other previous variables (all variables are 2-digit integers). Here is my code: #set the stations... (3 Replies)
Discussion started by: TheSMan5
3 Replies

7. Shell Programming and Scripting

Set the last 4 letter in the filename as a variable

Hi all, I want to set the last 4 letter in the filename as a variable. For example, i have AB1234.txt file and i need to have last 4 letter as a variable. It should be like ; get last four letter set var = 1234 How can i write this in C shell?? Thanks, zibi (3 Replies)
Discussion started by: zibi
3 Replies

8. Shell Programming and Scripting

Change the filename variable value

Hi guys, I have a variable where i am storing the filename (with full path). I just need the value before ".txt". But instead of getting the filename i am getting the contents of the filename. FileName=/appl/data/Input/US/Test.txt a=`awk -F"." '{print $1}' ${FileName}` echo $a... (3 Replies)
Discussion started by: mac4rfree
3 Replies

9. Shell Programming and Scripting

removing \n in PERL from the data fetched from db

Hi I am fetching data from table which contains SQL query like this into a variable $qry SELECT ABC, DEF WHERE (XYZ = 'Normalization' or ABC_TYPE = 'DEF') and lookup_port like 'ABAC%' My requirement is I need to fetch a where clause to a variable if ( $qry =~... (3 Replies)
Discussion started by: gvk25
3 Replies

10. Shell Programming and Scripting

Deleting a row based on fetched value of column

Hi, I have a file which consists of two columns but the first one can be varying in length like 123456789 0abcd 123456789 0abcd 4015 0 0abcd 5000 0abcd I want to go through the file reading each line, count the number of characters in the first column and delete... (2 Replies)
Discussion started by: swasid
2 Replies
drotmg.f(3)							      LAPACK							       drotmg.f(3)

NAME
drotmg.f - SYNOPSIS
Functions/Subroutines subroutine drotmg (DD1, DD2, DX1, DY1, DPARAM) DROTMG Function/Subroutine Documentation subroutine drotmg (double precisionDD1, double precisionDD2, double precisionDX1, double precisionDY1, double precision, dimension(5)DPARAM) DROTMG Purpose: CONSTRUCT THE MODIFIED GIVENS TRANSFORMATION MATRIX H WHICH ZEROS THE SECOND COMPONENT OF THE 2-VECTOR (DSQRT(DD1)*DX1,DSQRT(DD2)*> DY2)**T. WITH DPARAM(1)=DFLAG, H HAS ONE OF THE FOLLOWING FORMS.. DFLAG=-1.D0 DFLAG=0.D0 DFLAG=1.D0 DFLAG=-2.D0 (DH11 DH12) (1.D0 DH12) (DH11 1.D0) (1.D0 0.D0) H=( ) ( ) ( ) ( ) (DH21 DH22), (DH21 1.D0), (-1.D0 DH22), (0.D0 1.D0). LOCATIONS 2-4 OF DPARAM CONTAIN DH11, DH21, DH12, AND DH22 RESPECTIVELY. (VALUES OF 1.D0, -1.D0, OR 0.D0 IMPLIED BY THE VALUE OF DPARAM(1) ARE NOT STORED IN DPARAM.) THE VALUES OF GAMSQ AND RGAMSQ SET IN THE DATA STATEMENT MAY BE INEXACT. THIS IS OK AS THEY ARE ONLY USED FOR TESTING THE SIZE OF DD1 AND DD2. ALL ACTUAL SCALING OF DATA IS DONE USING GAM. Parameters: DD1 DD1 is DOUBLE PRECISION DD2 DD2 is DOUBLE PRECISION DX1 DX1 is DOUBLE PRECISION DY1 DY1 is DOUBLE PRECISION DPARAM DPARAM is DOUBLE PRECISION array, dimension 5 DPARAM(1)=DFLAG DPARAM(2)=DH11 DPARAM(3)=DH21 DPARAM(4)=DH12 DPARAM(5)=DH22 Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: November 2011 Definition at line 91 of file drotmg.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.2 Tue Sep 25 2012 drotmg.f(3)
All times are GMT -4. The time now is 12:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy