need script to process ls-l command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need script to process ls-l command
# 8  
Old 04-14-2004
does ne1 know how list the ordinary files not directories

been through man pages and there is no command

as the command to display directoy only is ls -d */

Last edited by sinner; 04-14-2004 at 02:20 PM..
# 9  
Old 04-14-2004
pipe the output of your ls -l command to grep -v ^d

that says do not display any entries that have the directory attribute set.
# 10  
Old 04-14-2004
cheers m8 it worked

only got 1 thing left to do is to calculate the total number of bytes

should this be added into another file to calculate the total number of bytes
# 11  
Old 04-14-2004
you could wrap the whole statement up into a loop then execute the ls portion on each specific file while you are doing that you can start the counter to add up all the bytes.

the more and more this progresses the more and more it sounds like homework.
# 12  
Old 04-15-2004
ok i think i'm on the right track

i've changed the file, i have a file called C which has the following code:

{n++;t+=$4};END{print "total number of files "n " " "total size"t
print $5, $9}

the code to run on command line is :

Ls -l | grep -v ^d | awk -f C

my problem is that it only print one file out of the list. i have 19 oridinary files and only the last file is being printed. how can i make it print out the entire list cuz @ the moment the code which prints from the list is "print $5, $9"

can ne1 help me with this small problem

Last edited by sinner; 04-15-2004 at 12:51 PM..
# 13  
Old 04-15-2004
ok guyz i got it done

u can do whatever u want to do with this post

but i'd like to thanx the following members :

google

Optimus_P

for helping me complete this task

l8er brosSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command to get exact tomcat process I am running ignoring other java process

Team, I have multiple batchjobs running in VM, if I do ps -ef |grep java or tomcat I am getting multiple process list. How do I get my exact tomcat process running and that is unique? via shell script? (4 Replies)
Discussion started by: Ghanshyam Ratho
4 Replies

2. AIX

Command or script to inform server owner about process

Hi all, How to inform server owner if the particular process is down. I need command or script to do the above. TIA (3 Replies)
Discussion started by: sumanthupar
3 Replies

3. Shell Programming and Scripting

script to get child process for a process

!/bin/sh pid=$(ps -Aj | grep MSTRSvr | grep -v grep | awk '{print $1}') sid=$(ps -Aj | grep MSTRSvr | grep -v grep | awk '{print $3}') ps -s "$sid" I am not able to get the desired output it says process list error if i use watch ps -s "$sid" it considers only the first session id (5 Replies)
Discussion started by: schippada
5 Replies

4. Shell Programming and Scripting

script to monitor the process system when a process from user takes longer than 15 min run.

get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same. hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Discussion started by: kirankrishna3
1 Replies

5. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

6. Shell Programming and Scripting

Process diff command output in a shell script

diff -yta file1 file2 #!/usr/abc/b/bin/perl5.6 | #!/usr/abc/b/bin/perl5.8 Notable thing about above line is "|" appears at 62nd position. When the same line is assigned in a variable in a ksh script, using ss=$(diff -yta file1 file2) it appears as ... (4 Replies)
Discussion started by: bhaliyajalpesh
4 Replies

7. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

8. Shell Programming and Scripting

Perl script to kill the process ID of a command after a certain period

All, I am trying to build a script in perl that will alllow me to pass the IP address to a ping command and redirect the output to a file and then kill that process after a certain period of time. let's say, I call my script ping.pl, I would like to be able to run it like this for example :... (7 Replies)
Discussion started by: Pouchie1
7 Replies

9. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

10. Shell Programming and Scripting

Script - How to automatically start another process when the previous process ends?

Hi all, I'm doing automation task for my team and I just started to learn unix scripting so please shed some light on how to do this: 1) I have 2 sets of datafiles - datafile A and B. These datafiles must be loaded subsequently and cannot be loaded concurrently. 2) So I loaded datafile A... (10 Replies)
Discussion started by: luna_soleil
10 Replies
Login or Register to Ask a Question