Solved

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

Posted on 2000-04-29
7
162 Views
Last Modified: 2010-04-21
i want to store the Output of Cmd like
 " wc -c filename" in a Shell var...
 how can i do it..
thanx
0
Comment
Question by:vmahendru
  • 4
  • 2
7 Comments
 

Accepted Solution

by:
ravindra042100 earned 50 total points
ID: 2761792
Hello, try this ..

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

This should work ...
0
 

Author Comment

by:vmahendru
ID: 2761892
Adjusted points from 25 to 50
0
 

Author Comment

by:vmahendru
ID: 2761893
it did not work out... first tell me
 can u please explain the steps .. i am not very good in UNIX...
   
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 84

Expert Comment

by:ozo
ID: 2765280
What did not work when you tried it?
In which shell do you want to store a variable?
0
 

Author Comment

by:vmahendru
ID: 2768267
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
 
LVL 84

Expert Comment

by:ozo
ID: 2770147
From C, you might call grep with popen insteead of system.
0
 

Author Comment

by:vmahendru
ID: 2772055
thanx ozo,  i got the answer
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question