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

Posted on 2000-04-29
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..
Question by:vmahendru
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2

Accepted Solution

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

sys>cat ans
ATT=`wc -l trialfile`
echo $ATT

This should work ...

Author Comment

ID: 2761892
Adjusted points from 25 to 50

Author Comment

ID: 2761893
it did not work out... first tell me
 can u please explain the steps .. i am not very good in UNIX...
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 84

Expert Comment

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

Author Comment

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..
LVL 84

Expert Comment

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

Author Comment

ID: 2772055
thanx ozo,  i got the answer

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machineā€¦
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 find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

737 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