Sponsored Content
Top Forums Shell Programming and Scripting How to calculate mode for several files HELPPPP!! Post 302607033 by balajesuri on Tuesday 13th of March 2012 11:32:52 AM
Old 03-13-2012
From what I understood:

Code:
$ cat input
2005-01-21    05:30:00    0.518736    -163
2005-01-20    05:30:00    0.518736    -160
2005-01-22    05:30:00    0.518736    -159
2005-01-23    05:30:00    0.518736    -157
2005-12-25    05:30:00    0.518736    -157
2005-12-26    05:30:00    0.518736    -157
2005-12-22    05:30:00    0.518736    -156
2005-12-30    05:30:00    0.518736    -156
2005-12-05    05:30:00    0.518736    -155
2005-12-17    05:30:00    0.518736    -155
2005-12-21    05:30:00    0.518736    -155
2005-12-23    05:30:00    0.518736    -155
2005-12-24    05:30:00    0.518736    -155
2005-12-31    05:30:00    0.518736    -155
2005-01-03    05:30:00    0.518736    -154
$
$ perl -ane '$x{$F[3]}++;
END {
    $val = 0; $key = 0;
    while (($k, $v) = each %x) { 
        if ($v > $val) { $key = $k; $val = $v }
    }
    open I, "< input";
    for (<I>) {
        chomp; @y = split /\s+/;
        print "$y[1]\t$y[2]\t$key\n";
    }
    close I;
}' input
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
05:30:00        0.518736        -155
$

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calculate size of some files

Hi, 1-I want to calculate the size of all files which are generated during last month in a directory. How can I do that ? Of cours, I find them by : $ls -l | grep jun but how to calculate the sum of their size ? 2- the same but for all files generated last month and before that. many thanks... (11 Replies)
Discussion started by: big123456
11 Replies

2. Shell Programming and Scripting

calculate from three files

Hi all I have 3 three files like: file1: 1|100 2|200 3|300 4|400 5|500 file2: 1|200 2|200 3|600 4|800 file3: 1|300 2|100 (5 Replies)
Discussion started by: koti_rama
5 Replies

3. Shell Programming and Scripting

Calculate Files Created Today

I need to figure out how to get all the files from a certian dir ./123/*sat files and ./230/*sat files and several other directories which have these *sat files in them. I need to calculate how many were created today and how many yesterday from 2:00 pm on the 28th to 2pm on the 29th. It's a... (1 Reply)
Discussion started by: xgringo
1 Replies

4. Shell Programming and Scripting

How to calculate the entropy of a single directory that contains many files

Hello, I'm new member of shell scripting and i face some difficulties. To begin, i try to write an algorithm that calculate from one directory containing nfdump files (288) the entropy of one day 24hours. Each of the file is 5 min interval (nfdump -r nfcapd.200908250000 -s srcip) 1st (nfdump... (0 Replies)
Discussion started by: draxmas
0 Replies

5. UNIX for Dummies Questions & Answers

changing mode of files in subdirectories

Hi I actually need to change the mode to 777 in the current directory as well as subdirectories how to achieve that. I have /usr/sol/home/workfold as the main directory there are many directies and files in the workfold directory . I need to chmod 777 to all the directories and files under... (2 Replies)
Discussion started by: ssuresh1999
2 Replies

6. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies

7. Shell Programming and Scripting

Shell script to calculate the size of files

Dear all, Please help me to write a script that can calculate the size of files. For example: I have a directory which contain thousands of files. I need to know the size of files that their name begin with abc_123 Thank all!! (4 Replies)
Discussion started by: hainguyen1402
4 Replies

8. Programming

perl - calculate the number of lines from particular files

Hi, plz see the below code. here my aim is to calculate the number of lines in unprocessedData.out if this file contains 40 lines then lastly $linenum should print 40.(except blank lines) i have tried below code but it giving me the output only one. can anyone help me how to do ? ... (9 Replies)
Discussion started by: pspriyanka
9 Replies

9. Red Hat

How to cache login in ldap clients !!! Please helpppp !!!!

Hey guys iīve one big problem with nscd.conf this donīt work i tried many examples of configuration the nscd.conf simply donīt work when i stop the ldap server i try access by ssh on the client i canīt make logon. And the database on /var/db/nscd donīt work. follows below the conf of... (0 Replies)
Discussion started by: paulo_eduardo
0 Replies

10. Shell Programming and Scripting

Calculate percent using values in 2 files

Trying to use file1 which is the actual counts in $2 associated with each $1 entry. The total of each $1 is in file2 with the total in $3. So when there is a match between $1 in file1 with $1 in file2, then the % is calculated using the $2 value of file1 and $3 value of file2. Thank you :). ... (4 Replies)
Discussion started by: cmccabe
4 Replies
GIT-COLUMN(1)							    Git Manual							     GIT-COLUMN(1)

NAME
git-column - Display data in columns SYNOPSIS
git column [--command=<name>] [--[raw-]mode=<mode>] [--width=<width>] [--indent=<string>] [--nl=<string>] [--padding=<n>] DESCRIPTION
This command formats its input into multiple columns. OPTIONS
--command=<name> Look up layout mode using configuration variable column.<name> and column.ui. --mode=<mode> Specify layout mode. See configuration variable column.ui for option syntax. --raw-mode=<n> Same as --mode but take mode encoded as a number. This is mainly used by other commands that have already parsed layout mode. --width=<width> Specify the terminal width. By default git column will detect the terminal width, or fall back to 80 if it is unable to do so. --indent=<string> String to be printed at the beginning of each line. --nl=<N> String to be printed at the end of each line, including newline character. --padding=<N> The number of spaces between columns. One space by default. AUTHOR
Written by Nguyen Thai Ngoc Duy <pclouds@gmail.com[1]> GIT
Part of the git(1) suite NOTES
1. pclouds@gmail.com mailto:pclouds@gmail.com Git 1.8.3.1 06/10/2014 GIT-COLUMN(1)
All times are GMT -4. The time now is 09:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy