07-26-2005
okay I modified my script to say:
"test.sh" 7 lines, 133 characters
fdate=`ls -al test.txt | cut -f2-3 -d'0' | cut -f1-4 -d' ' `
echo $fdate
mydate=`$fdate+%Y%m%d%I%M%S`
echo $mydate
I get the following error:
Jul 26 12:59
test.sh[4]: Jul: not found
Appreciate your reply.
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
WORDWRAP(3) 1 WORDWRAP(3)
wordwrap - Wraps a string to a given number of characters
SYNOPSIS
string wordwrap (string $str, [int $width = 75], [string $break = "0], [bool $cut = false])
DESCRIPTION
Wraps a string to a given number of characters using a string break character.
PARAMETERS
o $str
- The input string.
o $width
- The number of characters at which the string will be wrapped.
o $break
- The line is broken using the optional $break parameter.
o $cut
- If the $cut is set to TRUE, the string is always wrapped at or before the specified $width. So if you have a word that is larger
than the given width, it is broken apart. (See second example). When FALSE the function does not split the word even if the $width
is smaller than the word width.
RETURN VALUES
Returns the given string wrapped at the specified length.
EXAMPLES
Example #1
wordwrap(3) example
<?php
$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap($text, 20, "<br />
");
echo $newtext;
?>
The above example will output:
The quick brown fox<br />
jumped over the lazy<br />
dog.
Example #2
wordwrap(3) example
<?php
$text = "A very long woooooooooooord.";
$newtext = wordwrap($text, 8, "
", true);
echo "$newtext
";
?>
The above example will output:
A very
long
wooooooo
ooooord.
Example #3
wordwrap(3) example
<?php
$text = "A very long woooooooooooooooooord. and something";
$newtext = wordwrap($text, 8, "
", false);
echo "$newtext
";
?>
The above example will output:
A very
long
woooooooooooooooooord.
and
something
SEE ALSO
nl2br(3), chunk_split(3).
PHP Documentation Group WORDWRAP(3)