02-21-2013
Hi Guys,
Thanks for the help.
The awk command now returns
I need it to return:
Both numbers in the file end with a number followed by 00.
The Awk command seems to remove the final 0 from the sum.
I should have mentioned that these are actually figures with the decimal point removed so, 000000027300 = 273.00 and 000000178800 = 1788.00 and that is why it is important that the 00 at the end of the total remains.
Apologies for the confusion
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hey gurus,
my-build1-abc
my-build10-abc
my-build2-abc
my-build22-abc
my-build3-abc
basically i want to numerically sort the entire lines based on the build number. I dont zero pad the numbers because thats "how it is" ;-)
sort -n won't work because it starts from the beginning.
... (10 Replies)
Discussion started by: gurpal2000
10 Replies
2. UNIX for Dummies Questions & Answers
Hello All,
I am after the script or the command which can scan the entire file for a string $PART_ID and when found to extract/copy the corresponding $PART_ID value (e.g THIRE_PTY_SOFTWARE for the 1st occurance of $PART_ID in the attached file) to a file.
Appreciate your help.
Thanks in... (3 Replies)
Discussion started by: forumthreads
3 Replies
3. Shell Programming and Scripting
Hi Experts,
I am adding a column of numbers with awk , however not getting correct output:
# awk '{sum+=$1} END {print sum}' datafile
2.15291e+06
How can I getthe output like : 2152910
Thank you..
# awk '{sum+=$1} END {print sum}' datafile
2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies
4. Web Development
Hi,
Can someone please tell me how I can replace every occurrence of a string with another string, in the entire mysql database?
What this means is, i just dont want to operate table by table. I want to search the database and automatically replace the string /opt/cacti/scripts/ with... (1 Reply)
Discussion started by: SkySmart
1 Replies
5. Shell Programming and Scripting
Hi,
I have a file whose lines are something like
Tchampionspsq^@~^@^^^A^@^@^@^A^A^Aÿð^@^@^@^@^@^@^@^@^@^@^A^@^@^@^@^?ð^@^@^@^@^@^@^@?ð^@^@^@^@^@^@pppsq^@~^@#@^@^@^@^@^@^Hw^H^@^@^@^K^@^@^@^@xp^At^@^FTtime2psq^@ ~^@^^^A^@^@^@^B^A
I need to extract all words matching T*psq from the file.
Thing is... (4 Replies)
Discussion started by: shekhar2010us
4 Replies
6. Shell Programming and Scripting
Hi All,
I have a file testarun.txt contains the below lines and i want to print the lines if the character positions 7-8 matches 01.
201401011111
201401022222
201402013333
201402024444
201403015555
201403026666
201404017777
201404028888
201405019999
201405020000
I am trying the... (4 Replies)
Discussion started by: Arunprasad
4 Replies
7. Shell Programming and Scripting
I would like to be able to use a regular expression to find and replace entire strings, but not replace if the string is a substring in a larger string.
Example:
$string = "ABC ABCDEF ABC ABCDEF ABC";
Something like - $string =~ s/ABC/XYZ/g;
->Desired:
$string = "XYZ ABCDEF XYZ ABCDEF... (3 Replies)
Discussion started by: rjulich
3 Replies
8. Shell Programming and Scripting
so im searching the process table with:
ps -ef | awk -F"./rello.java" '{ print substr($0, index($0,$2)) }'
I only want it to print everything that's infront of the "./rello.java". That's because im basically getting the arguments that was passed to the rello.java script.
this works.
... (2 Replies)
Discussion started by: SkySmart
2 Replies
9. UNIX for Beginners Questions & Answers
I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file.
Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies
10. UNIX for Beginners Questions & Answers
Hi,
Sure it's an easy one, but it drives me insane.
input ("|" separated):
1|A,B,C,A
2|A,D,D
3|A,B,B
I would like to count the occurence of each capital letters in $2 across the entire file, knowing that duplicates in each record count as 1.
I am trying to get this output... (5 Replies)
Discussion started by: beca123456
5 Replies
sum(1) General Commands Manual sum(1)
NAME
sum - print checksum and block or byte count of file(s)
SYNOPSIS
[file ...]
Remarks
is obsolescent and should not be used in new applications that are intended to be portable between systems. Use instead (see cksum(1)).
DESCRIPTION
calculates and prints to standard output a checksum for each named file, and also prints the size of the file in 512 byte blocks, rounded
up.
The default algorithm is a 16-bit sum of the bytes in which overflow is ignored. Alternate algorithms can be selected with the and
options.
Standard input is used if no file names are given.
is typically used to verify data integrity when copying files between systems.
Options
recognizes the following options:
Use an alternate algorithm in which the 16-bit sum is right rotated
with each byte in computing the checksum.
Use the 32-bit cyclical redundancy check (CRC) algorithm used by
RETURN VALUE
returns the following values upon completion:
All files were processed successfully.
One or more files could not be read or some other error occurred.
If an inaccessible file is encountered, continues processing any remaining files, but the final exit status is affected.
DIAGNOSTICS
Read error conditions are indistinguishable from end of file on most devices; check the block or byte count.
WARNINGS
This command is likely to be withdrawn from X/Open standards. Applications using this command might not be portable to other vendors'
platforms. The usage of cksum(1) is recommended.
SEE ALSO
cksum(1), wc(1).
STANDARDS CONFORMANCE
sum(1)