10-31-2011
Wow! Thanks....those were amazingly fast replies!
What is the difference between the two methods? Is there a difference (in any scenario) or is it just a matter of personal choice?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all..
I got a problem..
Its easy to redirect o/p to a file.. But Is it possible to redirect the O/P to a variable?
For example:
I've a command in my script:
string1=cut -d ':' -f2 file.txt
When I do:
echo $string1
The value is empty... Pls suggest me how to store the value... (7 Replies)
Discussion started by: smartbuddy
7 Replies
2. Shell Programming and Scripting
I have a variable A
echo $A
5060
I am exporting the value X,Y,Z and it id fetching right thing and When I run
C=`${X} -l ${Y} ${Z} "trap '' INT;. ~/.profile >/dev/null 2>/dev/null; netstat -na | grep \$A`"
here it is going to same directory and also running netstat -na | grep 5060
... (4 Replies)
Discussion started by: madhusmita
4 Replies
3. Shell Programming and Scripting
I want to instert Category:XXXXX into the 2. line
something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong:
sed "2i\\${n}Category:$cat\n"
Sample:
Titel Blahh Blahh abllk sdhsd sjdhf
Blahh Blah Blahh
Blahh
Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies
4. Shell Programming and Scripting
I am sure it has been answered in some form or the other in this forum but trust me I have spent last couple of hours looking for an answer but can't find it.
I want to do a very simple operation within my script.
Let's say I have 4 files with the names file1.log, file2.log, file3.log and... (6 Replies)
Discussion started by: sssccc
6 Replies
5. Shell Programming and Scripting
Hi,
I am trying to do the following thing
var='date'
$var
Above command substitutes date for and in turn runs the date command and i am getting the todays date value.
I am trying to do the same thing as following, but facing some problems,
unique_host_pro="sed -e ' /#/d'... (3 Replies)
Discussion started by: gvinayagam
3 Replies
6. Shell Programming and Scripting
Hello Experts
I am newbie to unix and writing one script to make archive files
Problme i am facing is : I have used find command to find the type of files and I am storing find command results in a variable.
When I echo the variable I can see that path is printed properly but when i am... (5 Replies)
Discussion started by: mitsyjohn
5 Replies
7. Shell Programming and Scripting
Hi
How to use a variable to store the filename of a file which was found by the 'find' command.
can this be practical-->var = find . -name "filename.dat"
Please help.. (1 Reply)
Discussion started by: ayyappaas
1 Replies
8. Shell Programming and Scripting
I wrote this script
#!/bin/bash
var=`du -sch /var/log/messages;du -sch /var/log/maillog`
echo $var
I am getting result as follows.
# sh my.sh
2.1M /var/log/messages 2.1M total 296K /var/log/maillog 296K total
I need it like below
2.1M /var/log/messages
296K... (3 Replies)
Discussion started by: anilcliff
3 Replies
9. Shell Programming and Scripting
Is it possible to store a command inside a variable?
i want this piece to be stored inside a variable, so i can use it later in a different command
$u | cut -d " " -f 2
var="$u | cut -d " " -f 2"
eval $var
I tried to use eval but I receive this error:
-f 2: command not found
... (5 Replies)
Discussion started by: velos
5 Replies
10. Programming
I am trying to store output of python command in variable. Could you please help how I can do that ?
For example I am executing the following command - "CentOS" in server_desc
The output would be True or False
I would like to store the output in a variable say outPut and use condition... (4 Replies)
Discussion started by: atanubanerji
4 Replies
LEARN ABOUT SUNOS
cpc_event_diff
cpc_event_diff(3CPC) cpc_event_diff(3CPC)
NAME
cpc_event_diff, cpc_event_accum - simple difference and accumulate operations
SYNOPSIS
cc [ flag... ] file... -lcpc [ library... ]
#include <libcpc.h>
void cpc_event_accum(cpc_event_t *accum, cpc_event_t *event);
void cpc_event_diff(cpc_event_t *diff, cpc_event_t *after, cpc_event_t *before);
The cpc_event_accum() and cpc_event_diff() functions perform common accumulate and difference operations on cpc_event(3CPC) data struc-
tures. Use of these functions increases program portability, since structure members are not referenced directly .
cpc_event_accum()
The cpc_event_accum() function adds the ce_pic fields of event into the corresponding fields of accum. The ce_hrt field of accum is set to
the later of the times in event and accum.
SPARC:
The function adds the contents of the ce_tick field of event into the corresponding field of accum.
:
The function adds the contents of the ce_tsc field of event into the corresponding field of accum.
cpc_event_diff()
The cpc_event_diff() function places the difference between the ce_pic fields of after and before and places them in the corresponding
field of diff. The ce_hrt field of diff is set to the ce_hrt field of after.
SPARC:
Additionally, the function computes the difference between the ce_tick fields of after and before, and places it in the corresponding field
of diff.
:
Additionally, the function computes the difference between the ce_tsc fields of after and before, and places it in the corresponding field
of diff.
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Obsolete |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
cpc(3CPC), cpc_buf_add(3CPC), cpc_buf_sub(3CPC), cpc_event(3CPC), libcpc(3LIB), attributes(5)
The cpc_event_accum() and cpc_event_diff() functions exist for binary compatibility only. Source containing these functions will not com-
pile. These functions are obsolete and might be removed in a future release. Applications should use cpc_buf_add(3CPC) and
cpc_buf_sub(3CPC) instead.
28 Mar 2005 cpc_event_diff(3CPC)