07-26-2005
I got it....
filedate=`ls -al test.txt | cut -f2-3 -d'0' | cut -f1-4 -d' ' `
echo $filedate
date=$filedate
dte=`date +%Y%m%d%H%M%S`
echo $dte
Result is:
20050726135232
Thanks! Vino for the idea.
Regards,
Radhika.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am trying to test input from the user, if they press enter with out an Y or N. I have the characheter thing sorted but when it comes to a blank or empty key press I am having trouble.
if ; then
clear
echo "Sorry, that is an invalid choice!"
exit
fi
I am using a KSH script in... (3 Replies)
Discussion started by: jagannatha
3 Replies
2. Shell Programming and Scripting
I am trying to assign list of files that created that day to a variable 'filename'
filename=`ls -ltr |grep "Mar 6" | awk '{print$9}'`
If there are no files created that day, my script just hangs, i need help with some login here.
i am also trying to figure out a way to look for files that... (3 Replies)
Discussion started by: gundu
3 Replies
3. Shell Programming and Scripting
Hi there!
I'm trying to write a script that will capture output from a command and assign it to a variable.
Let's say, for example, I'd like to catch from inside the script whatever the following command outputs:
ls *.aaa
and put it into a variable "listoffiles".
What I tried was:
set... (3 Replies)
Discussion started by: machinogodzilla
3 Replies
4. Shell Programming and Scripting
Hi Friends,
Do someone know how to capture value in a shell variable from oracle sql?
Requirement : In a table we want to count the number of records and want to pass this value to a shell variable where it can be manipulated later. In ksh shell we open oracle connection from sqlplus.
For... (1 Reply)
Discussion started by: sourabhsharma
1 Replies
5. Shell Programming and Scripting
I am trying to capture the process on a red hat linux system with the highest cpu utilization into a variable. I have been playing with ps command but really do not think I am making the correct progress.
For instance:
top - 09:01:16 up 63 days, 18:29, 2 users, load average: 0.39, 0.49, 0.48... (5 Replies)
Discussion started by: jaysunn
5 Replies
6. Programming
Hi ,
I wonder if in java I can pipe the below output of the printf into a variable:
System.out.printf(" This is a test %s\n", myVariable);
I want to keep the output of the printf command to create my history array.
Thanks. (2 Replies)
Discussion started by: arizah
2 Replies
7. Shell Programming and Scripting
Hi All,
I'm working on creating a parts database. I currently have access to a manufacturer database in HTML and am working on moving all of the data into a MySQL db. I have created a sed script that strips out the HTML and unnecessary info and separates the script into one line for each field.... (3 Replies)
Discussion started by: dkr
3 Replies
8. UNIX for Dummies Questions & Answers
Hello All,
I have the below script and output.
cat test.sh
#!/bin/bash -x
logit()
{
echo " - ${*}" > ${LOG_FILE}
}
LOG_FILE=/home/infrmtca/bin/findtest.log
VAR=`find . -type f -name "*sql"`
logit $VAR
Output:
cat /home/infrmtca/bin/findtest.log
-... (9 Replies)
Discussion started by: Ariean
9 Replies
9. Shell Programming and Scripting
hi,
i want to check whether a a variable contains some value or is empty in a shell script. so if the variable contains some value i want to do some job and if the variable doesnt contain any value then i need to skip that job.
here is a sample script
read_filenames.sh contains
... (5 Replies)
Discussion started by: Little
5 Replies
10. Shell Programming and Scripting
How to capture system() function output in awk variable and the print that awk variable..... (8 Replies)
Discussion started by: bharat1211
8 Replies
LEARN ABOUT PHP
datetimeinterface.format
DATETIMEINTERFACE.FORMAT(3) 1 DATETIMEINTERFACE.FORMAT(3)
DateTime::format - Returns date formatted according to given format
Object oriented style
SYNOPSIS
public string DateTime::format (string $format)
DESCRIPTION
string DateTimeImmutable::format (string $format) string DateTimeInterface::format (string $format)
Procedural style
string date_format (DateTimeInterface $object, string $format)
Returns date formatted according to given format.
PARAMETERS
o $object
-Procedural style only: A DateTime object returned by date_create(3)
o $format
- Format accepted by date(3).
RETURN VALUES
Returns the formatted date string on success or FALSE on failure.
EXAMPLES
Example #1
DateTimeInterface.format(3) example
Object oriented style
<?php
$date = new DateTime('2000-01-01');
echo $date->format('Y-m-d H:i:s');
?>
Procedural style
<?php
$date = date_create('2000-01-01');
echo date_format($date, 'Y-m-d H:i:s');
?>
The above example will output:
2000-01-01 00:00:00
NOTES
This method does not use locales. All output is in English.
SEE ALSO
date(3).
PHP Documentation Group DATETIMEINTERFACE.FORMAT(3)