how can i store the o/p of Unix cmd to Shell ver.

i want to store the Output of Cmd like
 " wc -c filename" in a Shell var...
 how can i do it..
thanx
vmahendruAsked:
Who is Participating?
 
ravindra042100Connect With a Mentor Commented:
Hello, try this ..

sys>cat ans
#!/usr/bin/ksh
ATT=`wc -l trialfile`
echo $ATT

This should work ...
0
 
vmahendruAuthor Commented:
Adjusted points from 25 to 50
0
 
vmahendruAuthor Commented:
it did not work out... first tell me
 can u please explain the steps .. i am not very good in UNIX...
   
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
ozoCommented:
What did not work when you tried it?
In which shell do you want to store a variable?
0
 
vmahendruAuthor Commented:
hi ozo
   i have written a program in c and in this program made one system call for grep... i want to store the output of this grep Cmd in my C program... can u help me how can i do it..
  thanx
0
 
ozoCommented:
From C, you might call grep with popen insteead of system.
0
 
vmahendruAuthor Commented:
thanx ozo,  i got the answer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.