Search Results

Search: Posts Made By: ranabhavish
959
Posted By Yoda
By the way why do you even need a for loop and...
By the way why do you even need a for loop and several pipes to awk to do all these?

You could do the whole thing in one awk program:
awk -F, '
BEGIN {
CONVFMT = "%.2f"...
959
Posted By Akshay Hegde
Here is a way to get what you want $ echo...
Here is a way to get what you want

$ echo "CE2DD,N,5055,16.12.2013,3.114,12195.89,MVR,003388,Web::00000005055,Web Payment" | \
awk -F',' '{ arr[$1","$5","$8] += $6} END {for (i in arr) print i...
5,519
Posted By Don Cragun
It sounds like whatever is creating your .csv...
It sounds like whatever is creating your .csv files is not adding the proper line terminator (a newline character) at the end of the file. Then, when you open the file with vi and re-write it, vi...
11,398
Posted By Jotne
Since I do not like to use bc because its not in...
Since I do not like to use bc because its not in all image. And normal I use bash. To do use math I use awk. This should work in most image.
Sed is not tool for math, so I do not see any reason...
11,398
Posted By fpmurphy
If you have a large number of such numbers to...
If you have a large number of such numbers to process, you might be better off using the Korn shell, which has builtin floating point support, because of the overhead in invoking the bc utility.
...
11,398
Posted By wisecracker
Longhand using OSX 10.7.5, default bash terminal....
Longhand using OSX 10.7.5, default bash terminal.
#!/bin/bash --posix
# Save IFS.
ifs_str="$IFS"
IFS="."
# Number with 3rd decinal place as 6. NOTE: no zero at the start but "-" instead!...
11,398
Posted By RudiC
If you really really really insist on a sed...
If you really really really insist on a sed solution, try this as a starting point; you will need to extend it for further carry operations:echo 205.5686 | sed 's/\(\...\)[0-4].*/\1/;t;
...
11,398
Posted By Corona688
sed cannot do math. sed cannot round numbers. ...
sed cannot do math. sed cannot round numbers.

This seemingly simple question is difficult to solve completely in bc itself because it simply does not calculate in that fashion. The rounding at...
11,398
Posted By in2nix4life
A quick and dirty way: echo...
A quick and dirty way:


echo "scale=2;($a*$b)+.01"|bc
1,313
Posted By Akshay Hegde
@ranabhavish please use codetag for data also..
@ranabhavish please use codetag for data also..
1,313
Posted By pamu
Try sort -t- -nk3 -k2M -nk1 file
Try

sort -t- -nk3 -k2M -nk1 file
1,313
Posted By Akshay Hegde
Try for considering only month $ sort...
Try

for considering only month

$ sort -t- -k2M file

01-MAY-13 2.38.11.00.100089 IN 4512 0000741881
01-JUN-13 2.38.11.00.100089 IN 1514 0000764631
01-JUN-13 2.38.19.00.100000 IN 2698...
1,239
Posted By Don Cragun
If the sort utility on your system provides a -M...
If the sort utility on your system provides a -M option (to sort month names), sort can reorder lines the way you want, but it won't change spaces to tabs:
sort -k1.8,1 -k 1.4M,1.6 -k1,1.2 -k5 file...
Showing results 1 to 13 of 13

 
All times are GMT -4. The time now is 07:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy