Sponsored Content
Top Forums Programming how to store string in variable Post 302607233 by slackman on Wednesday 14th of March 2012 02:48:19 AM
Old 03-14-2012
how to store string in variable

sorry i'm newbies c programer

how to store string to variable with value flexible.

example

int hh=1; ---> value flexible 1,2,3,4,5;
int xx=1; ---> value flexible 1,2,3,4,5;
char test="value=%d and value=%d",hh,xx; --> not working
char test2="value2=%d and value2=%d",hh,xx; --> not working

char complete=test+test2; ----> merge string not working
sprintf("%s",complete);


want output

value=1 and value=1 value2=1 and value2=1


please help me

thank you for advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To store the output in a variable

Hi, I am getting the following error while executing the script. Please can someone throw some light where is the problem. Many thanks. ./check: temp: not found The directory related to SEP instance 4 does not exist. The script is as follows. SEP_APP="/scp/sepx/app... (2 Replies)
Discussion started by: Sudhakar333
2 Replies

2. UNIX for Dummies Questions & Answers

How to Store command O/P to a variable...

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

3. Shell Programming and Scripting

Help in scripting, store value in variable

Hi all, I have a script in which i need to run a command like "/opt/dell/srvadmin/sbin/omreport about" and output will be something like Version : 6.3.0 Copyright : Copyright (C) xxx Inc. 1995-2010 All rights reserved. Company : xxx Inc. In this i need to save the version... (13 Replies)
Discussion started by: Renjesh
13 Replies

4. Shell Programming and Scripting

Not able to store command inside a shell variable, and run the variable

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

5. Shell Programming and Scripting

Search file for string and store last result to variable

Hi, I'm trying to search a text file for a string: "energy(sigma->0)=". To do so, I executed the grep command, which returned many matches, for example: energy without entropy = -112.16486170 energy(sigma->0) = -112.16520778 energy without entropy = -112.16488936 ... (5 Replies)
Discussion started by: gwr
5 Replies

6. UNIX Desktop Questions & Answers

How to store the value of grep in a variable

Hi , I was trying to store the value of a grep command to store in a variable so i can use it somewhere else in my script but i am getting error, i am using bash shell in linux: var= `grep -n "$DATE" testfile.log | head -n 1 | sed -n 's/^\(*\).*/\1/p` echo "$var"I get the error: unexpected... (5 Replies)
Discussion started by: learninguser235
5 Replies

7. Shell Programming and Scripting

how to store output to a variable

I need some help: 1) I have a out put from a shell script, the out put looks like this: Attempting privilege escalation using sudo ... List backups for CLTST: Start date Status Ret. Class Label -------------------- ------------ ------------ ... (2 Replies)
Discussion started by: samk
2 Replies

8. Shell Programming and Scripting

Extract a string from a file and store it in variable

Hi, I've a file ImageSizeDetails.txt with the following contents: Image Name: swncd 01.10.00.04 Created: Wed Jan 9 14:05:48 2013 Image Type: ARM Linux Multi-File Image (gzip compressed) Data Size: 7351011 Bytes = 7178.72 kB = 7.01 MB Load Address: 00008000 Entry Point: ... (6 Replies)
Discussion started by: Parameswaran
6 Replies

9. Shell Programming and Scripting

I can't store value in the variable

!#bin/bash clear var= grep @gmail.com email.txt | wc -l echo $var echo $var exit 0 OUTPUT: 1000 _ _ Where _ represent space (no value or nothing) (4 Replies)
Discussion started by: Muhammad Rehan
4 Replies

10. Shell Programming and Scripting

Store ^M character in variable

Hi, I want to store ^M character in a variable to be later written to a file. Can you please help. TempOut="$_var1 `print '\x0D'` $_var1" ..... .... echo $TempOut >> logfile TempOut="$_var1 `echo -e '\x0D'` $_var1" ..... .... echo $TempOut >> logfile But both ways I am... (2 Replies)
Discussion started by: tostay2003
2 Replies
vparadmin(1M)															     vparadmin(1M)

NAME
vparadmin - modifies attributes for the virtual partition flexible administrative capability SYNOPSIS
vp_name] | | DESCRIPTION
The command is used to add or delete a Designated-Admin vPar. It can also be used to change the virtual partition flexible administrative password. Options are valid when the virtual partition flexible administrative capability is enabled. Options recognizes the following command line options and arguments. The options are mutually exclusive. Adds the virtual partition to the Designated-Admin vPar list in a secure virtual partition environment. It will prompt for the existing virtual parti- tion flexible administrative password before allowing the addition. Deletes the virtual partition from the Designated-Admin vPar list. It will prompt for the existing virtual partition flexible administrative password before allowing the deletion. Changes the virtual partition flexible administrative password. It will prompt for the old password for validation. Displays the Designated-Admin vPar list. If no arguments are supplied, indicates whether the virtual partition flexible administrative capability is enabled or disabled. SECURITY RESTRICTIONS
This command is restricted to processes owned by a superuser. RETURN VALUE
The command exits with one of the following values: Successful completion. One or more error conditions occurred. EXAMPLES
Use vparadmin without any options: The virtual partition fle xible administrative capability is disabled. Add the name of the virtual partition called to the Designated-Admin vPar list: ---------- Designated-Admin virtual partitions ---------- Oslo To change the virtual partition flexible administrative password: Old password: New password: Re-enter new password: vPar flexible administrative password successfully changed. ERRORS
displays error messages on standard error for any of the following conditions: o An invalid option is specified. o An invalid value is specified for an option or a value is omitted. o does not exist in the monitor database. o One or more options are specified more than once. AUTHOR
was developed by the Hewlett-Packard Company. SEE ALSO
vparboot(1M), vparcreate(1M), vparmodify(1M), vparremove(1M), vparreset(1M), vparresources(5), vparstatus(1M), vpmon(1M). vparadmin(1M)
All times are GMT -4. The time now is 04:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy