01-18-2006
#!/usr/bin/ksh
ls -l $1 | awk 'BEGIN { FS=" "; sm=0; } { sm = sm + $5 } END { print "Total bytes : "sm; }'
this will take care of what you have asked...
if $1 contains value, then it will calculate for givent directory
if $0 contains nothing, then it will calculate for current directory
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
OS:AIX 64 bits.
Requirement is to convert file_size from bytes to megabytes through shell script as below:
export DBALIST="xyz@rediffmail.com"
ls -ltr abcd.txt > file_size.result
export file_size=`awk -F" " '{ print $5 }' file_size.result`
if ]
then
mailx -s "File abcd.txt... (3 Replies)
Discussion started by: a1_win
3 Replies
2. Shell Programming and Scripting
Hi,
on unix box, under /local/home/userid/logs folder, apps generated the following files
sw_warn.log
sw_error.log
eaijava.log
if there any application specific errors, the above file will keep growing.
if the file exceed 5000000 bytes, I would like to have a shell script which do... (6 Replies)
Discussion started by: lookinginfo
6 Replies
3. Shell Programming and Scripting
I am looking for an easy way to calculate the sum of three values (*-12, *-01, *-02) which are contained after a comma (,). I have found an awk command that will sum every 3rd value, but I am not interested in the values before the comma (,).
awk '{s+=$1}NR%3==0{print s;t+=s;s=0}'I am only... (8 Replies)
Discussion started by: ncwxpanther
8 Replies
4. Shell Programming and Scripting
I am new to shell script.I have records like below in 4 different files which have about 10000 records each, all records unique and sorted based on column 2.
1 2 3 4 5 6
---------------------------
SR|1010478|000044590|1|0|0|
SR|1014759|000105790|1|0|0|
SR|1016609|000108901|1|0|0|... (2 Replies)
Discussion started by: reach.sree@gmai
2 Replies
5. Shell Programming and Scripting
I want to make a script which takes the number of argument, add those argument and gives output to the user, but I am not getting through...
Script that i am using is below :
#!/bin/bash
sum=0
for i in $@
do
sum=$sum+$1
echo $sum
shift
done
I am executing the script as... (3 Replies)
Discussion started by: mukulverma2408
3 Replies
6. Shell Programming and Scripting
I am writing a bash script to find out all the files in a directory which are empty. I am running into multiple issues. I will really appreciate if someone can please help me.
#!/bin/bash
DATE=$(date +%m%d%y)
TIME=$(date +%H%M)
DIR="/home/statsetl/input/civil/test"
... (1 Reply)
Discussion started by: monasharma13
1 Replies
7. UNIX for Dummies Questions & Answers
Hello guys. I really hope someone will help me with this one..
So, I have to write this script who:
- creates a file home/student/vmdisk of 10 mb
- formats that file to ext3
- mounts that partition to /mnt/partition
- creates a file /mnt/partition/data. In this file, there will... (1 Reply)
Discussion started by: razolo13
1 Replies
8. Shell Programming and Scripting
hello,
suppose, entered input is of 1-40 bytes, i need it to be converted to 40 bytes exactly.
example: if i have entered my name anywhere between 1-40 i want it to be stored with 40 bytes exactly.
enter your name:
donald duck (this is of 11 bytes)
expected is as below - display 11... (3 Replies)
Discussion started by: shravan.300
3 Replies
9. Shell Programming and Scripting
Hi all;
Here is my file:
V1.3=4
V1.4=5
V1.1=3
V1.2=6
V1.3=6
Please, can you help me to write a script shell that counts the sum of values in my file (4+5+3+6+6) ?
Thank you so much for help.
Kind regards. (3 Replies)
Discussion started by: chercheur111
3 Replies
10. Shell Programming and Scripting
I want to count the number of lines, I need this result be a number, and sum the last numeric column, I had done to make this one at time, but I need to make this for a crontab, so, it has to be an script, here is my lines:
It counts the number of lines:
egrep -i String file_name_201611* |... (5 Replies)
Discussion started by: Elly
5 Replies
LEARN ABOUT DEBIAN
hwloc-gather-topology
HWLOC-GATHER-TOPOLOGY(1) hwloc HWLOC-GATHER-TOPOLOGY(1)
NAME
hwloc-gather-topology - Saves the relevant Linux topology files and the lstopo output for later (possibly offline) usage.
SYNOPSIS
hwloc-gather-topology [options] <path>
OPTIONS
-h --help display help message and exit
DESCRIPTION
hwloc-gather-topology saves all the relevant topology files into an archive (<path>.tar.bz2) and the lstopo output (<path>.output). The
utility for example stores the /proc/cpuinfo file and the entire /sys/devices/system/node/ directory tree.
These files can be used later to explore the machine topology offline. Once the tarball has been extracted, it may for instance be given
to some hwloc command-line utilities through their --input option. It is also possible to override the default topology that the hwloc
library will read by setting the extracted path in the HWLOC_FSROOT environment variable.
Both archive and lstopo output may also be submitted to hwloc developers to debug issues remotely.
hwloc-gather-topology is a Linux specific tool, it is not installed on other operating systems.
NOTE: It is highly recommended that you read the hwloc(7) overview page before reading this man page.
EXAMPLES
To store topology information to be used later (possibly on a different host) please run:
hwloc-gather-topology /tmp/myhost
It will store all relevant topology files in the /tmp/myhost.tar.bz2 archive and the lstopo output in the /tmp/myhost.output file. These
files can be transferred on another host for later/offline analysis and/or as the input to various hwloc utilities.
To use these data with hwloc utilities you have to unpack myhost.tar.bz2 archive first:
tar jxvf /tmp/myhost.tar.bz2
A new directory named myhost now contains all topology files. Then you ask various hwloc utilities to use this topology instead of the one
of the real machine by passing --input myhost. To display the topology just run:
lstopo --input ./myhost
It is not necessary that the topology is extracted in the current directory, absolute or relative paths are also supported:
lstopo --input /path/to/remote/host/extracted/topology/
To see how hwloc would distribute 8 parallel jobs on the original host:
hwloc-distrib --input myhost --single 8
To get the corresponding physical indexes in the previous command:
hwloc-calc --input myhost --po --li --proclist $(hwloc-distrib --input myhost --single 8)
Any program may actually override the default topology with a given archived one even if it does not have a --input option. The
HWLOC_FSROOT environment variable should be used to do so:
HWLOC_FSROOT=myhost hwloc-calc --po --li --proclist $(hwloc-distrib --single 8)
All these commands will produce the same output as if executed directly on the host on which the topology information was originally gath-
ered by the hwloc-gather-topology script.
RETURN VALUE
Upon successful execution, hwloc-gather-topology will exit with the code 0.
hwloc-gather-topology will return nonzero exit status if any kind of error occurs, such as (but not limited to) failure to create the ar-
chive or output file.
SEE ALSO
hwloc(7), lstopo(1), hwloc-calc(1), hwloc-distrib(1)
1.4.1 Feb 27, 2012 HWLOC-GATHER-TOPOLOGY(1)