Programming :: Looping Throghu Input Files With Different Number Of Days?

Nov 3, 2010

I want to itemize addition for each type of transactions. The example below is for 3 days,10/13/2010, 10/14/2010, & 10/15/2010.

PROD =89.25+89.25+104.47= 282.97
TAX =9.37+9.37+10.37 = 29.71
ETAX = 1+1+1 = 3

[code]...

View 8 Replies


ADVERTISEMENT

Programming :: Perl: Turning A Seconds-since-the-epoch Number Into "X Days Ago" Or Similar?

Aug 26, 2010

Is there a perl module that will let me turn numbers into human readable measures of time? For example, 1280513294 would be "26 days ago". If so, what's its name?

View 2 Replies View Related

Programming :: Delete Files Older Than 7 Days?

Jan 3, 2011

I am new to unix, I am looking for a script to delete files older than 7 days but i also want to exclude certain directories (like arch,log .....) and also some files with extensions ike .ksh, .ch, ..............) in directories and sub directories

View 4 Replies View Related

Ubuntu :: Show Number Of Days Since January 1 On Orage

Jan 20, 2010

I'm using the XFCE desktop and the orage clock applet.

Is there any way I can display the number of days elapsed since 1st of January of the current year?

Can't seem to fine an strftime function for it.

View 7 Replies View Related

Ubuntu :: Method Required To Find Out Number Of Days Between 2 Dates?

Dec 15, 2010

Can someone show me a simple method to find out number of days between 2 dates?

Example: How would I find the number of days between 25-12-2003 to 25-12-2010? Could someone write a line of code that takes in the two dates and outputs the number of days? Or is there a program that can do this?

I know of websites that do this but I'd also like an offline method.

View 9 Replies View Related

General :: Offline Method Required To Find Out Number Of Days Since A Certain Date?

Dec 13, 2010

What offline method is there of finding out days since a certain date. Example: How would someone find the number of days from 1-Jan-2003 to 7-Dec-2010? Could someone write a script that takes in the 2 dates and output the number of days?

View 5 Replies View Related

Programming :: Looping Over Mysql Query Results In Bash?

Sep 15, 2010

I am querying a single string column in a table. The string values have spaces in them. I want to loop over each value in bash. I set IFS to split lists on newlines instead of spaces. When I try this, it is splitting the list of results on the actual character 'n', not the newline ''.

DATA=`mysql -u root -ppassword --silent 'SELECT name FROM table_a;'`
IFS=$'
'
for i in $DATA; do
echo "item = $i"

[Code]....

View 5 Replies View Related

Programming :: Looping Using While Read Line And A Variable Instead Of A File?

Sep 24, 2010

I created the following.

x="top
middle
bottom"

I would like to make the following work.

while read line
do
echo $line
done

instead of importing a file I would like to use the variable $x I tried using pipes, but with no luck. My goal is to read one line at a time, but not have to export my data to another file, I would like to keep it all within one script.

View 3 Replies View Related

Programming :: VBA / Excel - Looping Through Image Controls Based On Cell Contents?

Jun 28, 2011

I have an Excel Spreadsheet which reports upon weekly performance. One portion of the worksheet looks at week over week increases /decreases. I've placed a number of image controls (15 in Total) next to cells which calculate week over week change. The image controls simply display an image depending on whether the value of the adjacent cell is positive or negative. So, here is my basic working IF statement:

Code:

Private Sub Worksheet_Change(ByVal UpDown As Range)
If Range("J26") > 0 And IsNumeric(Range("J26").Value) Then
Image1.Picture = LoadPicture("C:path oup_arrow.gif")
ElseIf Range("J26") < 0 And IsNumeric(Range("J26").Value) Then

[code]....

As you can see, this is pretty simple. What I'd like to do is find a way to loop through all 15 controls and avoid having 15 IF statements run on the Worksheet_Change() event. The cells containing the week over week values are all in the same column, but not continuous. Involved cells are: ("J26", "J27", "J33", "J34", "J35", "J36", "J37", "J38", "J39", "J40", "J42", "J43", "J44", "J45", "J46")

View 6 Replies View Related

Programming :: Bash Script For Moving X Number Files From / Direct1 To / Direct2?

Jan 29, 2010

I have no Bash skills but Im badly in need of a script to move the first 20,000 or whatever number of files from a directory containing over 200,000 files to a new directory. The problem is that I cant access the directory because its so large so I want to break it into chunks, but keep the files in order if possible. If you know of a script to meet my needs, please post it. Otherwise Ill post my fumblings with Bash until I find the right way to fix my problem.

View 14 Replies View Related

Programming :: BASH Script Optimization For Testing Large Number Of Files

Sep 18, 2010

I want to move files from a $SOURCEDIR to a $DESTBASE/$DESTDIR. Under $DESTBASE there are many directories, and I need to test beforehand if a file from $SOURCEDIR already exists in any of them.

This is obviously extremely slow, and the real use case involves dozens of dirs and thousands of files. Creating a temporary "index" file for the find command (instead of running it every iteration) speeds it up a little, but it's still very clumsy.

View 14 Replies View Related

Programming :: Standardize A Perl Script So That Can Use It No Matter How Many Input Files

Mar 21, 2010

I need write a script that can compare multiple input files and output a file. The basic idea is:1: All my input files are in the same format2: I want to find in-common lines (in-common 1) from some of my input files (e.g., input1, 2 an 3), and find in-common lines (in-common 2) from the rest of my input files (e.g., input 4,5,6,7). And then, compare in-common1 and in-common2 and remove any overlap from in-common 1.3: Output the remaining in-common 1 file after removing any of its overlap with in-common 2I know how to write this script by putting all the filenames in one script and compare them. But the thing is, if I have more input files, such as 100, it might not be that efficient to write all filenames in one script and compare them.

I am wondering if there is any way to do such as:1: put all input filenames in a text file (file1)2: write a script3: Everytime, when I run this script, it will read in file1 directly no matter how many input files I have, give an output.I want this because I will have more and more input files and I don't wanna add multiple lines in the script just for reading the new inputfiles and compare them with the previous files. So, I guess this is something related to making my script a package or standardize it and make it easy to use in the future no matter how many input files I will have.

View 5 Replies View Related

Debian Programming :: Check If Files Exists By Read Input From A File

Jul 27, 2013

I need a script that dose the following checks if files exists by read input from a file then compares them to the files listed in the directory if they don’t exists the script would report back which file dose not exists. I also need to format the output so that files are grouped in different groups, group A, B, and C and etc based on file name. I would like the output of that do not exists files to be sorted based on second number in the file name than group according. I understand some of the basics of bash scripting something along of the lines of a loop and if statements might do the trick. Below is what I have so far. I don’t car so much about the script reporting back the file exists I prefer to only know if the file is missing and is less than 3 days old. Problem is if a file dose not exists in the reports file the test compares against the wrong file.

Group A

Foo22000.tar.gz
Foo22010.tar.gz

Group B

foo25000.tar.gz
foo25100.tar.gz

Group C

foo26000.tar.gz

Code] ....

View 2 Replies View Related

Programming :: Search A Bunch Of Files In A Specific Folder For A Specific Number?

Jul 24, 2010

I need to search a bunch of files in a specific folder for a specific number and add all the numbers together to a total sum. I use Rsync everyday, everytime I run rsync i get a logfile (rsync output) witch contains the textstring "Total bytes sent: xxxxxx".

The "xxxxx" can vary in lenght. I need to extract the "xxxxxx" from each file and add the numbers together to a total size over a week or a month. Is this possible? And I wish to only use bash. One way of doing stuff at a time my friends .

View 5 Replies View Related

Ubuntu Servers :: Remove The Leading Number And Slash If The Input File Is In The New Format?

Sep 10, 2010

I'm thinking of a few ways to do this I'm curious how many better/equal ways there are to do the same task.in a file with format like: 20 text Gi0/2 some other junk I have it reformatted to look like this before going in a database: 0/2 20 text. But for whatever reason some of the new input text looks like this now: 20 text Gi1/0/2 some other junk

My script makes it look like this: 1/0/2 20 text. I want it to remove the leading number and slash if the input file is in the new format.

View 5 Replies View Related

General :: Fortran Runtime Error: Bad Real Number In Item 1 Of List Input

Feb 9, 2011

I am using the package Quantum espresso to get electron phonon coefficients for monolayer graphene. While applying one of the executables, I got the error: "At line 356 of file q2r.f90 (Unit 51 "a2Fq2r.51") Traceback not availabel: compile with -ftrace=frame or -ftrace=full. Fortran Runtime error: bad real number in item 1 of list input

View 3 Replies View Related

General :: Copy Files Less Than 7 Days Old?

May 6, 2011

I have searched for a way to copy file less than X days old and I found this:http://www.howtogeek.com/howto/ubunt...days-on-linux/ The syntax for deleting files less than 7 days old would be like this:find /path/to/files* -mtime -7 -exec rm {} ;I would like to copy the files to mntas, and I'm not sure what the syntax should be.ould this work?find /path/to/files* -mtime -7 -exec cp {} mnt
as ;

View 3 Replies View Related

General :: Finding Files Exactly 7 Days Old?

Apr 19, 2010

i am a newbie in linux ,i am writing a bash script to identify the files which are exactly 7 days ( a week old) i tried this command find /var/backup -mtime +7 -exec ls -d {} ;but this gives me even the files which are older than 7 days

[root@proxy access]# find . -mtime +7 -exec ls -d {} ;
./access.log.1.gz
./access.log.2.gz

[code]...

View 3 Replies View Related

Ubuntu :: Trying To Write Script To Perform Tasks Number Of Times Depending On User Input?

Apr 13, 2011

I'm trying to write a bash script with a for loop that will perform two tasks a number of times depending on the number the user enters at the start. Here is what I got so far. It works fine the first time but then it just exits with no error msgs. The problem is in the way I have written the loop command. I have searched the web for examples to find out what I'm doing wrong with no luck.

#!/bin/bash
declare -i Num=1
declare -i Strnum=8

[code]....

View 3 Replies View Related

OpenSUSE Network :: Move Files After N Days?

Sep 24, 2010

I have a script that moves files after 60 days from the FTP folder over to a trash folder which is not accessible by the FTP. From there I can delete the files whenever the drive get's full. That works fine so far.
The only thing that bothers me is that files moved to ".Trash" are not in any folder structure anymore (one big directory with the deleted files in it).

When I do a "ls -la" on the array {} I see the file names including the folders. I'm not sure if the find command or the mv command forgets about the directories.

This is the script: bash -c 'date;find /Volumes/data1/test/ -mtime +60 -type f -exec mv {} /Volumes/data1/.Trash/ ;;date' >> ~/mylog

View 2 Replies View Related

General :: Delete Files When It's Older 30 Days?

Jan 6, 2011

I am trying to put together ksh shell and I am new with writing scripts.How do you write a command to delete any files if it's 30 days old and also it's not currently being locked?

View 10 Replies View Related

General :: Delete Old Files Older Than 7 Days?

Sep 18, 2009

find -type f /path/* -mtime +7 -exec rm {} ;Is this the best way to delete only files (not directories) within /path that are older than 7 days? or is there a better way?

View 3 Replies View Related

CentOS 5 :: Delete Files Older Than 7 Days?

Jan 26, 2010

I've been trying to delete all files older than 7 days in a directory temp1.I have try different ways but nothing happend:

find /temp1/* -mtime +7 -exec rm rf
find . -mtime +7 -exec rm rf
find /temp1/* -mtime +7 -print -exec rm{}

View 13 Replies View Related

Programming :: How To Grep Process Running More Than 30 Days Only?

Aug 18, 2009

is there a way for me to grep the process that running more than 30 days only using linux command or script?

example:i do ps -ef to list out the process, then i want to filter only the process that always running more than 30 days..

View 8 Replies View Related

Ubuntu :: Delete Any Mpg Files That Are Captured From The Stream That Are More Than 7 Days Old?

Apr 23, 2011

I want to capture a mms stream daily. All works well with that, but I also want to delete any mpg files that are captured from the stream that are more than 7 days old. Will this command work?

Code:
#!/bin/bash
find /mnt/tera/all_video/thai3 -ctime +7 -name "*.mpg" -exec rm -f {} ; -ls > /var/log/thai3.log 2>&1

[code]....

View 2 Replies View Related

Ubuntu :: BASH Script To Move Files More Than 30 Days Old?

May 12, 2011

I need to move files to a backup drive if they are over 30 days old. All I could find, when looking for scripts, were ways to sort files by date and the solutions were all over the place and nothing seemed simple or good.

I've thought of building my own running "ls -al > filelist.txt" type of approach and then processing the file, but not sure that is best way. An array would be much easier and eliminate the file, but never done an array in bash.

View 9 Replies View Related

Networking :: Rsync - Sync Files Modified Within The Last 60 Days?

Jun 3, 2009

Can anybody tell me how I can synchronise files between two computers in a network that have been modified or created within the last 60 days?

View 3 Replies View Related

General :: Command To Find All Of The Files Which Have Been Accessed Within The Last 30 Days?

May 14, 2010

Command to find all of the files which have been accessed within the last 30 days?

View 1 Replies View Related

General :: Script That Will Move All 30 Days Old Files In A Folder?

Jan 22, 2010

I`m totally new to linux, in fact I`m a windows adminscenario:I need to run a script that will automatically move 30 days old files from particular folder to a particular folder.

View 3 Replies View Related

General :: Archive All Files To One Single File In Every 30 Days?

Apr 12, 2010

I have a directory there are many files are writing to it , I would like to write a script to do that , can please provide the advise .

archive all files to one single file in every 30 days , and then remove these old files .

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved