Sponsored Content
Top Forums Shell Programming and Scripting mv Filename variable to another filename Post 302185302 by gzs553 on Monday 14th of April 2008 03:39:45 PM
Old 04-14-2008
For some reason, my $group vairable will not pass to the $savgrp_rpt.
Still doesn't work.

# This script sends email that save group completed.
#!/bin/ksh
dat=`date +%m%d%y`
rdat=`date +%m/%d/%y`
tmp_savegrp=/export/legato/rpts/savegrp.tmp
cat $@ > $tmp_savegrp
group=`head -1 $tmp_savegrp |grep -v -i media |awk '{print $4,$5,$10}'
/usr/ucb/mail -s "$group Savegroup Report - $rdat" xxxx@xxx.com < $tmp_savegrp
savgrp_rpt=/export/legato/rpts/${group}_savegrp_rpt.$dat
cp $tmp_savegrp $savgrp_rpt
~
 

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

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... (3 Replies)
Discussion started by: RRVARMA
3 Replies

3. Shell Programming and Scripting

gzcat into awk and then change FILENAME and process new FILENAME

I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
Discussion started by: timj123
6 Replies

4. UNIX for Dummies Questions & Answers

'Crop' date from filename into a variable

Hi all, I have a scenario as below. I created a file - $touch myfile.onlytesting.20090227.txt I want to assign the date only - 20090227 into a variable x. How do I do this in unix command? Please help. Thanks;) (4 Replies)
Discussion started by: luna_soleil
4 Replies

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

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

Filename from splitting files to have the same filename of the original file with counter value

Hi all, I have a list of xml file. I need to split the files to a different files when see the <ko> tag. The list of filename are B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml ... (3 Replies)
Discussion started by: natalie23
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. UNIX for Dummies Questions & Answers

to extract all the part of the filename before a particular word in the filename

Hi All, Thanks in Advance I am working on a shell script. I need some assistance. My Requirement: 1) There are some set of files in a directory like given below OTP_UFSC_20120530000000_acc.csv OTP_UFSC_20120530000000_faf.csv OTP_UFSC_20120530000000_prom.csv... (0 Replies)
Discussion started by: aealexanderraj
0 Replies

10. Programming

to extract all the part of the filename before a particular word in the filename

Hi All, Thanks in Advance I am working on a shell script. I need some assistance. My code: if then set "subscriber" "promplan" "mapping" "dedicatedaccount" "faflistSub" "faflistAcc" "accumulator"\ "pam_account"; for i in 1 2 3 4 5 6 7 8;... (0 Replies)
Discussion started by: aealexanderraj
0 Replies
EIO_READLINK(3) 							 1							   EIO_READLINK(3)

eio_readlink - Read value of a symbolic link.

SYNOPSIS
resource eio_readlink (string $path, int $pri, callable $callback, [string $data = NULL]) DESCRIPTION
PARAMETERS
o $path - Source symbolic link path o $pri -The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL. If NULL passed, $pri internally is set to EIO_PRI_DEFAULT. o $callback -$callback function is called when the request is done. It should match the following prototype: void callback(mixed $data, int $result[, resource $req]); o $data -is custom data passed to the request. o $result -request-specific result value; basically, the value returned by corresponding system call. o $req -is optional request resource which can be used with functions like eio_get_last_error(3) o $data - Arbitrary variable passed to $callback. RETURN VALUES
eio_readlink(3) returns request resource on success or FALSE on error. EXAMPLES
Example #1 eio_readlink(3) example <?php $filename = dirname(__FILE__)."/symlink.dat"; touch($filename); $link = dirname(__FILE__)."/symlink.link"; $hardlink = dirname(__FILE__)."/hardlink.link"; function my_hardlink_cb($data, $result) { global $link, $filename; var_dump(file_exists($data) && !is_link($data)); @unlink($data); eio_symlink($filename, $link, EIO_PRI_DEFAULT, "my_symlink_cb", $link); } function my_symlink_cb($data, $result) { global $link, $filename; var_dump(file_exists($data) && is_link($data)); if (!eio_readlink($data, EIO_PRI_DEFAULT, "my_readlink_cb", NULL)) { @unlink($link); @unlink($filename); } } function my_readlink_cb($data, $result) { global $filename, $link; var_dump($result); @unlink($link); @unlink($filename); } eio_link($filename, $hardlink, EIO_PRI_DEFAULT, "my_hardlink_cb", $hardlink); eio_event_loop(); ?> The above example will output something similar to: bool(true) bool(true) string(16) "/tmp/symlink.dat" SEE ALSO eio_symlink. PHP Documentation Group EIO_READLINK(3)
All times are GMT -4. The time now is 02:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy