09-08-2014
Quote:
Originally Posted by
junior-helper
I guess you mean
echo "${var%.*}" and
echo "${var%%.*}"
Yes, you are right! How on earth i could mix that up so consistently.... *shakes head about himself*
bakunin
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I want to save the contents of a variable to a file. How can that be achieved?
I have tried with:
echo $varname > textfile.txt
but for some reason it does not print anything. (1 Reply)
Discussion started by: carl_vieyra
1 Replies
2. Shell Programming and Scripting
Hi all,
I am displaying my result in HTML format using tables.
I want to save the results in file in the same format along with the table only.
How do i do that in perl?
I have attached the table structure .
I want to save like that itself .
with regards (2 Replies)
Discussion started by: vanitham
2 Replies
3. Shell Programming and Scripting
Hi,
I'am using "time" to check execution time of some script. Is there any possibility to save time command result into a file ? (2 Replies)
Discussion started by: Physix
2 Replies
4. Shell Programming and Scripting
Does anybody know any alternative way to save output result of a program into another new file?
I got try the command below:
program_used input_file > new_output_file
program_used input_file >> new_output_file
Unfortunately, both the ">" and ">>" is not work at this case to save the output... (6 Replies)
Discussion started by: patrick87
6 Replies
5. Shell Programming and Scripting
Hi,
I have a 3rd party tool on Solaris 8. I am running it thorugh my script but I am not able to capture its output into a variable.
Like, I tried, but did not work.
output=`/usr/bin/myTool`
echo $output
Also, I tried saving in a file but when I run, output is always shown on the... (19 Replies)
Discussion started by: angshuman_ag
19 Replies
6. Shell Programming and Scripting
Hi,
in shell script, i have the command swstart -p which returns an output. i want to store the output of this command into a variable. how i can do that
excerpt from the script
#!/usr/bin/ksh
#
#
#
# Program: swstart -p
#
# Description: Starts the sentinels on Slave server
... (4 Replies)
Discussion started by: lookinginfo
4 Replies
7. Shell Programming and Scripting
Hi,
If I type:
ls -l *txt | awk '{print $8}'
I get the file listing if I am in the directory.
If I try to do the same from a job flow, doing also other things, I can't do
ls -l directory/*txt | awk '{print $8}' > directory/result.txt
or
echo ls -l directory/*txt | awk '{print... (8 Replies)
Discussion started by: essemario
8 Replies
8. UNIX for Dummies Questions & Answers
i want to save the output of /scripts/whoowns domain.com to a username
like $user = /scripts/whoowns domain.com
but I'm not sure how to do that
This is inside a bash script
how can I get the output of /scripts/whoowns
then save that to a variable?
thanks!
---------- Post updated at... (0 Replies)
Discussion started by: vanessafan99
0 Replies
9. Shell Programming and Scripting
Currently I have a perl code to combine two different files.
#! /usr/bin/perl -w
use strict;
open FP1,"A.txt";
open FP2,"B.txt";
my ($l1,$l2);
while(1)
{
$l1=<FP1>; chomp $l1;
$l2=<FP2>; chomp $l2;
last unless(defined $l1 or defined $l2);
print "$l1 $l2\n";
}
close FP2;... (4 Replies)
Discussion started by: Tzeronone
4 Replies
10. UNIX for Advanced & Expert Users
My requirement is to read a column data from a file & save it in a variable for each row & process it. I am using the below code-
Leadlines="$TGTFILE/Error.txt">>$log_file
while read line
do
id = ` echo $line | cut -d "," -f1 `
email = ` echo $line | cut -d "," -f2 `
-----------
done
My... (2 Replies)
Discussion started by: saga20
2 Replies
LEARN ABOUT OPENDARWIN
tcl_discardresult
Tcl_SaveResult(3) Tcl Library Procedures Tcl_SaveResult(3)
__________________________________________________________________________________________________________________________________________________
NAME
Tcl_SaveResult, Tcl_RestoreResult, Tcl_DiscardResult - save and restore an interpreter's result
SYNOPSIS
#include <tcl.h>
Tcl_SaveResult(interp, statePtr)
Tcl_RestoreResult(interp, statePtr)
Tcl_DiscardResult(statePtr)
ARGUMENTS
Tcl_Interp *interp (in) Interpreter for which state should be saved.
Tcl_SavedResult *statePtr (in) Pointer to location where interpreter result should be saved or restored.
_________________________________________________________________
DESCRIPTION
These routines allows a C procedure to take a snapshot of the current interpreter result so that it can be restored after a call to
Tcl_Eval or some other routine that modifies the interpreter result. These routines are passed a pointer to a structure that is used to
store enough information to restore the interpreter result state. This structure can be allocated on the stack of the calling procedure.
These routines do not save the state of any error information in the interpreter (e.g. the errorCode or errorInfo variables).
Tcl_SaveResult moves the string and object results of interp into the location specified by statePtr. Tcl_SaveResult clears the result for
interp and leaves the result in its normal empty initialized state.
Tcl_RestoreResult moves the string and object results from statePtr back into interp. Any result or error that was already in the inter-
preter will be cleared. The statePtr is left in an uninitialized state and cannot be used until another call to Tcl_SaveResult.
Tcl_DiscardResult releases the saved interpreter state stored at statePtr. The state structure is left in an uninitialized state and can-
not be used until another call to Tcl_SaveResult.
Once Tcl_SaveResult is called to save the interpreter result, either Tcl_RestoreResult or Tcl_DiscardResult must be called to properly
clean up the memory associated with the saved state.
KEYWORDS
result, state, interp
Tcl 8.1 Tcl_SaveResult(3)