Tagged Questions
2
votes
2answers
55 views
Linux listing files between two date without touch command
I need a command which will list the files between given date and time (YYYYMMDDHHMMSS - format) in to a text file.
I don want to use touch command as its creating permission issue.
I am new to this ...
4
votes
3answers
88 views
how to suppress bash octal number interpretation? (to be interpreted as decimal)
I have this:
date +"%H hours and %M minutes"
I use festival to say it up.. but it says like: "zero nine hours".. I want it to say "nine hours"!
but date always give me 09... so I wonder if bash ...
2
votes
2answers
92 views
How do I use an If-Else query based on the day of the week?
Problem: I need to check if today is Thursday and perform different actions based on the result of this condition. I tried two different approaches:
Getting the Day Name:
DAYOFWEEK=$(date +"%a")
...
2
votes
2answers
73 views
Displaying a specific date
I'm trying to display a specific date in Unix, using the date command, I can't figure out how to display a date other than today's date.
For example, if I was trying to display July 4, 2011 I use
$ ...
2
votes
1answer
355 views
Good method to compare time?
I need to check for the current time and abort the script if it is not proper time of day I am supposed to run it. Also, if anyone else runs it, it should abort.
For example: I need my script to only ...
1
vote
1answer
126 views
Outputting last modification date to another file?
I'm trying to read the number of lines in a file, and the last modification date of that file (e.g. if it was last modified Jan 18, 2013, it should output 2013-01-18), then append the data to the ...
0
votes
1answer
550 views
Convert any Date format in unix
How can I convert any user inputted date into yyyy/mm/dd?
For example user can input date in one of the following formats 20120121 , 2012-01-21, 01/21/2012, 01/21/2012 etc.
But I need to convert any ...
2
votes
3answers
510 views
Appending current date to filename
I'm trying to append the current date to the end of a file name, like what we see in logfiles:
TheFile.log.2012-02-11
I have been following this example and applied this to both a Unix and Linux ...
4
votes
3answers
364 views
Equivalent of date --reference in Solaris
The GNU implementation of the date command has a nice feature to show the date of the last modification of a reference file, and using the +FORMAT parameter it is easy to get the date in any format, ...
3
votes
2answers
188 views
List files created on Sundays
How do I list/find all the files created on Sundays or Mondays?
How do I use the date parameter to display them?
Something like :
ls -f date + %a
or
find -type f | date +%A
or
find -type f ...
5
votes
3answers
3k views
Find files which are created a certain time after or before a particular file was created
I need a shell script which finds files which are created 1 hour before or 1 hour after a particular file (test.txt) was created.
If I go with find -newer, that means I'd have to create a temporary ...
1
vote
2answers
308 views
Parsing the output of date with sed
I am trying to replace the whitespaces in the output of date with '_' with no success.
$date
Fri Sep 14 14:10:04 EDT 2012
$ date | sed 's/ /_/'
Fri_Sep 14 14:10:24 EDT 2012
As you can see, the ...
2
votes
1answer
315 views
How to insert a first column to many files + how to convert unix time to normal time
There are many-many files in a directory that has e.x.: the following content:
INPUT:
root 1324711901
sshd 1272725792
And I'm searching for a solution how to convert the content of the ...
3
votes
1answer
105 views
Generate time as expression of 1/1000ths of the day
Completely new to bash and having trouble working out how to make the arithmetic work. I think this should be easy, it's just.. argh.
I want to express the time of day in terms of 1/1000ths (ie, ...
2
votes
3answers
936 views
How to feed the results of date command into grep to filter results of another command
I need to use the result of a formatted date command (date +"%m/%d") as the grep filter to filter the results of another command that will display alerts on a system so that I only see alerts from the ...
10
votes
4answers
7k views
How do I convert an epoch timestamp to a human readable format on the cli?
How do I convert an epoch timestamp to a human readable format on the cli? I think there's a way to do it with date but the syntax eludes me (other ways welcome).
13
votes
9answers
6k views
Tool in UNIX to subtract dates
Is there any tool in Solaris UNIX (so no GNU tool available) to subtract dates? I know that in Linux we have gawk that can subtract one date from another. But in Solaris the maximum we have is nawk ...