02-25-2012
getting timestamp of a file and if it was accessed today then finding a line in it
i have my files and the variables value extracted from db is taken as
in1=slot0312
in2=best
in3=it is :veryliong/fine
as varibles..
i have a folder stuctures in my unix machine as :
/2011/hand_sl0312/best/HOD/file1.txt
/2011/hand_sl0312/happy/HOD/file1.txt
/2012/hand_sl0312/best/HOD/file1.txt
/2012/hand_sl0312/happy/HOD/file1.txt
/2012/hand_sl0612/normal/HOD/file1.txt
/2012/hand_sl0612/best/HOD/file1.txt
llly many more.
in2 variable values can be any of the folders names from folder /2012/hand_sl0312/ in machine extracted from db or /2012/hand_sl0612/ or /2012/hand_RI12/ ,etc
in1 values are all from folder /2012/ or /2013/ but here format remains hand_sl0312. so values for in1 is like sl0312,sl0612 , etc..if in1 value is sl0312 then it is to be searched in folder /2012/hand_sl0312/ and if in2 value is "best" as above eg then it is to be searched in /2012/hand_sl0312/best and in3 value is to find in that folder based on access of file in folder /2012/hand_sl0312/best/HOD/file1.txt .. i.e if file1.txt is acessed that day then find value in3 in that file . if present . then no need to output .if not present then it should be written in other file for output..
but this three values are compared by taking all at a time ..so for above example.
so in this example
in1=slot0312
in2=best
in3=it is :veryliong/fine
the file /2012/hand_sl0312/best/HOD/file1.txt will be searched for in3 variable value i.e "it is :veryliong/fine"..
if it would have been eg as
in1=slot0612
in2=normal
in3=alwaysdoing:verylioniseong/fine
then the file /2012/hand_sl0612/normal/HOD/file1.txt (found from all variables) should be checked if it was accessed same day then only for value in3=alwaysdoing:verylioniseong/fine will be searched
the folder /2012/ or /2011/ or /2013/ , etc should be choosen depending on value in1, i.e suppose value of in1=slot0612 then folder /2012/ should be choosen and if it conatains in1=slot0311 then folder /2011/ should be choosen . this folder is choosen from last two digits value from in1 as in1=slot0312 so last two digit is 12 so choose 2012 , iif it would be 11 then choose 2011 and then proceed..
this values in1, in2, in3 are extracted from database...so having a huge dataB..
unix code for this comparison is needed...plz help
Last edited by rajniman; 02-25-2012 at 03:08 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guys,
I have a directory in UNIX having files with the below format, i need to pickup the latest file having recent timestamp embedded on it, then need to rename it to a standard file name.
Below is the file format:
filename_yyyymmdd.csv, i need to pick the latest and move it with the... (1 Reply)
Discussion started by: kaushik25
1 Replies
2. Shell Programming and Scripting
Small query-
I want to do some operation on all the files older then today. Before I do that operation, i want to verify if the command works properly or not.
Surprisingly, the command below returns me file, which are created today -
find /mrk_archive/PG/ftp/incomming/gbs/2008 -type f... (2 Replies)
Discussion started by: kedar.mehta
2 Replies
3. UNIX for Dummies Questions & Answers
So, I know how to do some of this stuff on an individual level, but I'm drawing a blank as to how to put it all together.
I have a pattern that I'm looking for in a log file. The log file I know came in yesterday, so I want to limit the search to that day's listing of files. How would I do... (5 Replies)
Discussion started by: kontrol
5 Replies
4. Shell Programming and Scripting
Hi Frnds,
I need to find the line number of a particular line in a file and store that line number to a variable.
if a file named myfile contains following
look at the sun
look at the moon
look at the star
look at the ocean
i need to get the line number of the line 'look at the... (3 Replies)
Discussion started by: mvignesh
3 Replies
5. UNIX for Advanced & Expert Users
Hi all,
Recently I came across a challenge of finding the user accounts lying around on servers and not being used so much. Our client has hundreds of AIX, RedHat, and Solaris servers.
For AIX, I have made a script which uses lsuser and a little bit of sed and awk to show the user accounts... (7 Replies)
Discussion started by: admin_xor
7 Replies
6. Shell Programming and Scripting
I have a statistical file populating every minute as below:
2011-11-11-1108 1955 891
2011-11-11-1109 2270 1049
2011-11-11-1110 1930 904
2011-11-11-1111 2030 931
2011-11-11-1112 1944 900
2011-11-11-1113 1922 875
Instead of having the date and time in the given format (2011-11-11-1113) I... (10 Replies)
Discussion started by: thinktank
10 Replies
7. Shell Programming and Scripting
Good morning,
My first time actually posting in this forum, though I have used this forum to help with numerous projects.
I am trying to figure out why my if statement does not work. I have a file where a line is inputted every 15 seconds. I want this if statement to check what the last line... (3 Replies)
Discussion started by: Shanrunt
3 Replies
8. UNIX for Dummies Questions & Answers
Version Info
+++++++++++++++
RHEL 5.4
Since ls command lists file sizes in Bytes which can be long I use du command like below.
I have run the du command for the below files as shown below.
But I want pipe this output to ls command just to see the modified timestamp for these files. ... (7 Replies)
Discussion started by: kraljic
7 Replies
9. Shell Programming and Scripting
I've the files in a directory in the following format having date +%Y%m%d%H
YR_MNTH_2013061205
YR_MNTH_2013060107
and i need the latest file i.e; YR_MNTH_2013061205 to be moved to another folder
#!/bin/ksh
# Ksh 88 Version
for test_time in YR*
do
---
done
How can i achieve that !... (2 Replies)
Discussion started by: smile689
2 Replies
10. Shell Programming and Scripting
I am connecting to remote server and try to check if files with timestamp as Today's day are on the directory. Below is my code
TARFILE=${NAME}.tar
TARGZFILE=${NAME}.tar.gz
ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;
Today=`date +%Y%m%d`;
if ;then
echo "We... (1 Reply)
Discussion started by: digioleg54
1 Replies
MIXER(1) The Canonical Csound Reference MIXER(1)
NAME
mixer - Mixes together a number of soundfiles. .
DESCRIPTION
Mixes together a number of soundfiles, starting at different times and with individual channel selection from the input files.
SYNTAX
mixer [OPTIONS ... ] infile [[OPTIONS... ] infile] ...
INITIALIZATION
Flags:
o -A = Generate an AIFF output file.
o -W = Generate an WAV output file.
o -h = Generate an output file with no header.
o -c = Generate 8-bit signed_char sound samples.
o -a = Generate alaw sound samples.
o -u = Generate ulaw sound samples.
o -s = Generate short integer sound samples.
o -l = Generate long (32 bit) integer sound samples.
o -f = Generate floating point samples.
o -F arg = Specifies the gain to be applied to the following input file. If arg is a floating point number that gain is applied uniformly
to the input. Alternatively it could be a file name which specifies a breakpoint file for varying the gain for different periods.
o -S integer = Indicate at which sample to start to mix in the next input file.
o -T fpnum = Indicate at which time (in seconds) to start to mix in the next input file.
o -1 = Mix in channel 1 from next sound file.
o -2 = Mix in channel 2 from next sound file.
o -3 = Mix in channel 3 from next sound file.
o -4 = Mix in channel 4 from next sound file.
o -^ intx inty = Mix in channel x from next sound file as channel y in the output.
o -v = Verbose mode.
o -R = Continually rewrite the header while writing soundfile (WAV/AIFF).
o -H integer = Show a "heart-beat" to indicate progress, in style 1, 2 or 3.
o -N = Alert call (usually ringing the bell) when finished.
o -o fname = output file name (default: test.wav)
EXAMPLES
The default values are
mixer -s -otest -F 1.0 -S 0
For example
mixer -F 0.96 in1.wav -S 300 -2 in2.aiff -S 300 -^4 1 in3.wav -o out.wav
This creates a new sound file with a constant gain of 0.96 from in1.wav with the second channel of in2.aiff mixed in after 300 samples and
channel 4 of in3.wav outpout as channel 1 after 300 samples.
CREDITS
Author: John ffitch
1994
AUTHORS
Barry Vercoe
MIT Media Lab
Author.
Dan Ellis
MIT Media Lab,
Cambridge
Massachussetts
Author.
COPYRIGHT
5.10 08/01/2011 MIXER(1)