Sponsored Content
Top Forums Shell Programming and Scripting Use the information from filename in a for loop Post 302670371 by djrulz123 on Thursday 12th of July 2012 03:49:46 AM
Old 07-12-2012
it ain't working....i need only one of the 2 files to copy...that is the one with date 20120711...here the command is executing such that both the files are taken into consideration but none are getting copied...the details are given below


Code:
 
./Visage_CM_To_Check_delay_Files.sh
date=$(cat /info_d05/visage/SrcFiles/Customer_Master/Log_Files/last_date.txt)
+ + cat /info_d05/visage/SrcFiles/Customer_Master/Log_Files/last_date.txt
date=20120710
ls -1 /info_d05/visage/SrcFiles/Customer_Master/Input_Files/*.dat > /info_d05/visage/SrcFiles/Customer_Master/Log_Files/FILE_LIST.txt
+ ls -1 /info_d05/visage/SrcFiles/Customer_Master/Input_Files/AZ_CM_VSG_ADDR_V001_20120710022154_001.dat /info_d05/visage/SrcFiles/Customer_Master/Input_Files/AZ_CM_VSG_ADDR_V001_20120711022154_001.dat
+ 1> /info_d05/visage/SrcFiles/Customer_Master/Log_Files/FILE_LIST.txt
awk -F_ -v date="$date" 'substr($6,1,8)>date{print "cp /info_d05/visage/SrcFiles/Customer_Master/Input_Files/"$0" /info_d05/visage/SrcFiles/Customer_Master/"}' /info_d05/visage/SrcFiles/Customer_Master/Log_Files/FILE_LIST.txt
+ awk -F_ -v date=20120710 substr($6,1,8)>date{print "cp /info_d05/visage/SrcFiles/Customer_Master/Input_Files/"$0" /info_d05/visage/SrcFiles/Customer_Master/"} /info_d05/visage/SrcFiles/Customer_Master/Log_Files/FILE_LIST.txt
cp /info_d05/visage/SrcFiles/Customer_Master/Input_Files//info_d05/visage/SrcFiles/Customer_Master/Input_Files/AZ_CM_VSG_ADDR_V001_20120710022154_001.dat /info_d05/visage/SrcFiles/Customer_Master/
cp /info_d05/visage/SrcFiles/Customer_Master/Input_Files//info_d05/visage/SrcFiles/Customer_Master/Input_Files/AZ_CM_VSG_ADDR_V001_20120711022154_001.dat /info_d05/visage/SrcFiles/Customer_Master/


Last edited by djrulz123; 07-12-2012 at 04:58 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep and awk showing filename in loop

I am attempting to grep a list of files for a string an and then only extract the 3rd and 4th field of from the line. That's easy. But I want to prefix the line with the filename that the information came from. for filename in `ls -1 *.txt' do grep search_text $filename | awk '{print $3"... (5 Replies)
Discussion started by: sjohns6
5 Replies

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

3. Shell Programming and Scripting

filename in loop

i have a filename_1=file1.dat filename_2=file2.dat i want to pass the filename in a loop for((i=1;i<=2;i++) do awk{print $1} $filename_$i.dat done how should i pass the filename (2 Replies)
Discussion started by: r_t_1601
2 Replies

4. Shell Programming and Scripting

Print filename inside loop

Im want to print filename inside loop .. the code im using :- Filename_1=abc_20090623_2.csv.lk Filename_2=def_20090623_2.csv.lk i want to extract filename till .csv eg Filename_1=abc_20090623_2 Filename_2=def_20090623_2 How can i do this inside the for loop ... (3 Replies)
Discussion started by: r_t_1601
3 Replies

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

6. Shell Programming and Scripting

how to create variables in loop and assign filename after set command?

Hi, does anybody knows how to manage, that the filenames are assigned to a variable in a loop afer getting them with set command in a ksh, like: set B*.txt i=1 c=$# x=$((c+1)) echo "$x" while ] ; do _ftpfile$i="$"$i echo "$_ftpfile$i" i=$((i+1)) done The first echo returns,... (2 Replies)
Discussion started by: spidermike
2 Replies

7. Shell Programming and Scripting

loop and extract matching filename

i am unable to exact matching filename in the loop. Filename.in file contains Customer_Product_ Information_Customer_Product_ sale_Product_ /home_dir contains files CUST_INFO_990090_1111.csv "1","Customer Product Detail","1000","salary" "1","Information Customer Product... (2 Replies)
Discussion started by: onesuri
2 Replies

8. UNIX for Dummies Questions & Answers

Copying files with spaces in the filename in a for loop

Hi all, I've been tangoing with this one for a couple of days now and I'm still not making any progress. Basically I'm trying to match three numbers in a string from a text file with matching numbers in a jpeg, and then copying the results to another folder. Data looks like this: Model:... (4 Replies)
Discussion started by: faceonline
4 Replies

9. Emergency UNIX and Linux Support

Waiting for wildcard filename to exists in while loop

Hi Experts, We are developing a script which will wait for the trigger file(with datetime in the trigger file name). But the problem is when I use 'while' loop to wait for the file, it waits for the filename with wilcard in it that is wait for 'Trigger*.done' file. :eek: Below is the script ... (4 Replies)
Discussion started by: Amey Joshi
4 Replies

10. Shell Programming and Scripting

Use while loop to read file and use ${file} for both filename input into awk and as string to print

I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix. I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice. Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies
ppmtosixel(1)                                                 General Commands Manual                                                ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 03:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy