Shell programming - running the exe file and printing the output.. ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell programming - running the exe file and printing the output.. ?
# 1  
Old 01-22-2010
Shell programming - running the exe file and printing the output.. ?

hai

i have a directory lib

in that lib directory i have 10 batch files.

step i have to do is 1) EXECUTE ALL THE FILES by using the command dwarfdump <filename>| grep DW_AT_SUN_command_line

and put the output in one text file.instead of executing the files for all the 10 files .. can i read the files in the directory lib and pass the file name and print the filename and finally the output in the text file..?

how can i do it?

Kindly help .. i am very new to unix..


S
# 2  
Old 01-22-2010
Is this homework? If not,
show us what have you tried so far.

Welcome to forums by the way Smilie
# 3  
Old 01-22-2010
You can tell me

1) how to read all the files in a directory

and i can put that filename into a variable and execute the command >> output.file

Help

S
# 4  
Old 01-22-2010
try this, not efficient though

Code:
ls directory_name | while read filename
do
echo $filename
done

# 5  
Old 01-22-2010
ls ./logfile/lib | while read filename
do
echo $filename
dwarfdump $filename | grep DW_AT_SUN_command_line >> dward_output.txt
done

this is giving the output in dwarf_output.txt

but it is better if we have filename at the beginning of outputfile txt. before command execution.
# 6  
Old 01-22-2010
just change this

Code:
echo $filename

to
Code:
echo $filename >> outputfilename.txt

# 7  
Old 01-23-2010
thanks madhan..

S
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Printing Terminal Output to a Error File

I am having a bash script which is basically invoking a python program to validate the Source Query results against the target query results. I am placing all the queries in a .sql file. I want to write to a Error log file incase if the syntax is wrong or if the column is not present in the... (4 Replies)
Discussion started by: ronitreddy
4 Replies

2. UNIX for Dummies Questions & Answers

Help with printing advance output format from a file

Hi, below 'awk' code was given for my thread 'Help with printing output format from a file ' earlier, however script is not resulting expected output with below file content. cat test_tes123.dml record string("\001") emp_num; /* CHAR(11) NOT NULL*/ date("YYYYMMDD")... (1 Reply)
Discussion started by: AAHinka
1 Replies

3. UNIX for Dummies Questions & Answers

Help with printing output format from a file

Hi, I need help in printing data in below format from file extensions with .dml, i have listed details below file name is test_temp.dml, location in /home/users/test01/test_temp.dml file content: sample_type= record decimal(",") test_type; date("DD-MM-YYYY")(",") test_date... (2 Replies)
Discussion started by: AAHinka
2 Replies

4. Shell Programming and Scripting

Recursive file processing from a path and printing output in a file

Hi All, The script below read the path and searches for the directories/subdirectories and for the files. If files are found in the sub directories then read the content of the all files and put the content in csv(comma delimted) format and the call the write to xml function to write the std... (1 Reply)
Discussion started by: Optimus81
1 Replies

5. Shell Programming and Scripting

send arguments to a .exe file from a shell script

Folks , can anyone post a sample showing a way to parse a variable containing a string to a .exe file . Thanks Venu (2 Replies)
Discussion started by: venu
2 Replies

6. UNIX for Advanced & Expert Users

My command is still running but someone closed my shell, can I get my output still?

I ran an fs_usage (based off dtrace facility) but someone closed the window I think.. But I still see the process running # 15023 I tried fg 15023 but it told me no job control.. Is there anyway I can see my output? The scan has been running an hour and the output is valuable to me. (3 Replies)
Discussion started by: glev2005
3 Replies

7. Shell Programming and Scripting

output file of the shell script running through crontab is deleting automatical daily.

Dear Friends, I am working on IBM AIX. I have written one script and kept in the crontab as to run daily at 11:38 AM. and the output of the script to be appended to the file generated with the month name. but my file deleting daily and the new file is creating with the output of the shell... (2 Replies)
Discussion started by: innamuri.ravi
2 Replies

8. Programming

running exe

how we can run the exe when the system starts. (2 Replies)
Discussion started by: phani_sree
2 Replies

9. Programming

Running exe's from front end

Hi, I have created a tool which analyses and debugs cobol programs on Unix environment usin the C files. I now want to create a frontend for the tool in windows. For this i need to establish some kinda communication between the front the end and the back end. I know pipes in one way of... (0 Replies)
Discussion started by: Sinbad
0 Replies

10. UNIX for Dummies Questions & Answers

Running EXE files on UNIX

I'm trying to find out if a executible file created in visual basic will run in the CGI-BIN of a unix server. I see the C section but no mention of VB. Thanks Sean (1 Reply)
Discussion started by: seanstog
1 Replies
Login or Register to Ask a Question