10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i have a file say test with the below mentioned details
Folder Name Total space Space used
/test/test1 500.1GB 112.0 GB
/test/test2 3.2 TB 5TB
/test/test3 3TB 100GB
i need to calculate percentage of each row based on total space and space used and copy... (9 Replies)
Discussion started by: venkitesh
9 Replies
2. Shell Programming and Scripting
In the below awk, I am trying to calculate percent for a given id. It is very close the problem is when the # being used in the calculation is zero. I am not sure how to code this condition into the awk as it happens frequently. The portion in italics was an attempt but that lead to an error. Thank... (13 Replies)
Discussion started by: cmccabe
13 Replies
3. Shell Programming and Scripting
I am trying to run the awk below. My question is when I split the input, then run anotherawk to perform a calculation using that splitas the input there are no issues. When I try to combine them the output is not correct, is the split not working or did I do it wrong? Thank you :).
input
... (8 Replies)
Discussion started by: cmccabe
8 Replies
4. Shell Programming and Scripting
pcmpath query device |awk 'BEGIN{print "TYPE\tDEVICE NAME\tSERIAL\tSIZE\tHOSTNAME"}
/DEVICE/ {
disk=$5
printf "%s\t", $7
printf "%s\t", disk
getline; printf "%s\t", substr($2, length($2)-3)
("bootinfo -s " disk) | getline; printf... (3 Replies)
Discussion started by: Daniel Gate
3 Replies
5. Programming
hi there again,
i need to do a simple division with my data with a number of rows. i think i wanted to have a simple output like this one:
col1 col2 col3
val1 val2 val1/val2
valn valm valn/valm
any suggestion is very much appreciated. thanks much. (2 Replies)
Discussion started by: ida1215
2 Replies
6. Shell Programming and Scripting
My code is
awk '{
out=split(FILENAME,a,"/")
sub(/\./,"_",a)
sub(/\-/,"_",a)
NEWSTRING="main_"a"_"a"(" # The word we want to insert
gsub(/main\(/,NEWSTRING); # the word to be replaced
print "Main becomes ",NEWSTRING")","in file ",FILENAME >> "/home/ds2/test/NEW2.txt" ... (4 Replies)
Discussion started by: senior_ahmed
4 Replies
7. Shell Programming and Scripting
I have a list of coordinate data, sampled below.
54555209 784672723
I want it as:
545552.09 7846727.23
Below is my script:
BEGIN {FS= " "; OFS= ","} {print $1*.01,$2*.01}
This is my outcome:
5.5e7 7.8e8
How do I tell awk that I want to keep all the digits instead of outputting... (1 Reply)
Discussion started by: ndnkyd
1 Replies
8. Shell Programming and Scripting
Hello!
I need to write partitioning script wich would work in rescue mode. It will prepare partitions and unpack linux on it. However I need to calculate whole size of the disk and create:
/dev/sda1 --> One big partition (minus (2*size of memory) for swap)
/dev/sda2 --> Swap partition... (1 Reply)
Discussion started by: pug123
1 Replies
9. Shell Programming and Scripting
Hallo all,
I have a script which creates an output ... see below:
root@a7germ:/tmp/pax > cat 20061117.txt
523.047
521.273
521.034
517.367
516.553
517.793
513.114
513.940
I would like to use awk to calculate the (a)total sum of the numbers (b) The average of the numbers.
Please... (4 Replies)
Discussion started by: kekanap
4 Replies
10. Shell Programming and Scripting
I have been using x=ls -la "$f" | awk '{print $5}'
This allows me to the size of all the files in $f and echo $x later .
The only problem is instead of protecting the file size format of ls -la which is right to left, it rearranges it and reads it left to right.
Cyborg was kind... (1 Reply)
Discussion started by: chrchcol
1 Replies