The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script related query gopsman Shell Programming and Scripting 1 12-03-2007 12:50 AM
related to directory permission mxms755 UNIX for Dummies Questions & Answers 1 04-06-2006 08:55 AM
shell script related to server nitiwari Shell Programming and Scripting 2 09-07-2005 06:37 AM
1st post here! directory related question ( // )... MrOrange UNIX for Dummies Questions & Answers 2 06-26-2002 09:21 PM
Model script related question TioTony UNIX for Advanced & Expert Users 2 10-17-2001 10:35 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-01-2008
praneshmishra08 praneshmishra08 is offline
Registered User
  
 

Join Date: Aug 2008
Location: bangalore
Posts: 11
perl script related /tmp directory

hi friends.
i have to make a perl script to generate all users and space(how much they are using) and files(how much files they have) and time(how much time that accessed /tmp buffer) from /tmp directory.

please provide me guidance.

regards
pranesh b. mishra
  #2 (permalink)  
Old 09-01-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
What have you done so far? Where are you stuck?
  #3 (permalink)  
Old 09-01-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 921
Post

Here's some pseudocode (perl style) to help get you started:
Code:
my %data;
open(LS,"find /tmp -type f -ls | awk '{ print %1,$5,$8,$9,$10 }' |") || die "cannont run find $!";
while (<LS>) {
  if (/(\d+) (\w+) (.+)/) {
    $size=$1;
    $user=$2;
    $date=$3;
    $data{$user}{"size"}+=$size;
    if (is_later_than($data{$user}{"date"},$date)) {
      $data{$user}{"date"}=$date;
    }
  }
}
foreach $user(sort(keys %data)) {
  print "$user used $data{$user}{"size"}, last accessed $data{$user}{"date"}\n";
}
Note that this is a mix of perl and pseudocode, you'll need to fill in the blanks before it will actually run.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:43 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0