06-12-2012
bc does not support exponential notation.
Regards,
Alister
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value .
For Eg .
if the input file has a row :
abc xyz lmn 89 lm nk o p
I would like the script to create something like... (9 Replies)
Discussion started by: aYankeeFan
9 Replies
2. Shell Programming and Scripting
File A
aa <space> --D--A--D---DDY---M--UM-M--MY
Another file
D3
M9
So output shud be
Here in FileA D which is 3 after removing dash
after we have counted dash D is position at 9
and for M is 23
final output will be
D9
M23 (2 Replies)
Discussion started by: cdfd123
2 Replies
3. Shell Programming and Scripting
Hi all,
I do have a tab delimited file
a1 a2 b1 b2 c1 c2 d1 d2 e1 e2 f1 f2
0 0 123 546 0 0 0 0 0 0 0 0
0 0 345 456 765 890 902 1003 0 0 0 0
534 768 0 0 0 0 0 0 0 0 0 0
0 0 0 0 456 765 0 0 0 0 0 0
0 0 0 0 0 0 12 102 0 0 0 0
456 578 789 1003 678 765 345 400 801 1003 134 765... (5 Replies)
Discussion started by: Lucky Ali
5 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I would like to add a new column containing the row numbers to a text file. How do I go about doing that? Thanks!
Example input:
A X
B Y
C D
Output:
A X 1
B Y 2
C D 3 (5 Replies)
Discussion started by: evelibertine
5 Replies
5. UNIX for Dummies Questions & Answers
Hi,
Trying to add a row of numbers. There are 24 number across. Would like to have column 25 sum each row.
10 3 45 49 0 24... Sum
3 200 3 9 1 3 ...... Sum
9 7 20 9 8 10 ...... Sum
Thank you. (5 Replies)
Discussion started by: jimmyf
5 Replies
6. UNIX for Dummies Questions & Answers
I have a spreadsheet of extremely long rows of numbers. I want to print only the last column. Tried using printf but there seems to be too many rows.
example:
3 100 34 7 23 0 8 ..... X
400 203 778 1 ..........Y
58 3 9 0 100 ..........Z
I only want to print X, Y and... (1 Reply)
Discussion started by: jimmyf
1 Replies
7. Shell Programming and Scripting
the following is used to add numbers:
echo 7 47 47 44 4 3 3 3 3 3 | awk '{ for(i=1; i<=NF;i++) j+=$i; print j; j=0 }'
how do i multiply OR subtract a row of numbers using the above tactic? (8 Replies)
Discussion started by: SkySmart
8 Replies
8. Shell Programming and Scripting
Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do.
I have a file which is formatted as... (4 Replies)
Discussion started by: crunchgargoyle
4 Replies
9. Shell Programming and Scripting
Need help in coding:
File with several rows incl. numbers like
1 2 3 4
5 6 7 8
...
How can i build the sum of each row seperately?
10
26
...
Thx for help.
Please use CODE tags as required by forum rules! (13 Replies)
Discussion started by: smitty11
13 Replies
10. Shell Programming and Scripting
Hi,
i have a raw output file like this
167,63.50
167,63.50
168,63.68
166,63.68
168,63.68
I would like to add every each N rows (for example 60) and in a third column , a timestamp using the command date +"%H:%M"how can i do it with one single command ?
Thank you !! (5 Replies)
Discussion started by: Board27
5 Replies
SEQ(1) BSD General Commands Manual SEQ(1)
NAME
seq -- print sequences of numbers
SYNOPSIS
seq [-w] [-f format] [-s string] [-t string] [first [incr]] last
DESCRIPTION
The seq utility prints a sequence of numbers, one per line (default), from first (default 1), to near last as possible, in increments of incr
(default 1). When first is larger than last the default incr is -1.
All numbers are interpreted as floating point.
Normally integer values are printed as decimal integers.
The seq utility accepts the following options:
-f format Use a printf(3) style format to print each number. Only the A, a, E, e, F, f, G, g, and % conversion characters are valid,
along with any optional flags and an optional numeric mimimum field width or precision. The format can contain character
escape sequences in backslash notation as defined in ANSI X3.159-1989 (``ANSI C89''). The default is %g.
-s string Use string to separate numbers. The string can contain character escape sequences in backslash notation as defined in ANSI
X3.159-1989 (``ANSI C89''). The default is
.
-t string Use string to terminate sequence of numbers. The string can contain character escape sequences in backslash notation as
defined in ANSI X3.159-1989 (``ANSI C89''). This option is useful when the default separator does not contain a
.
-w Equalize the widths of all numbers by padding with zeros as necessary. This option has no effect with the -f option. If any
sequence numbers will be printed in exponential notation, the default conversion is changed to %e.
The seq utility exits 0 on success and non-zero if an error occurs.
EXAMPLES
# seq 1 3
1
2
3
# seq 3 1
3
2
1
# seq -w 0 .05 .1
0.00
0.05
0.10
SEE ALSO
jot(1), printf(1), printf(3)
HISTORY
The seq command first appeared in Plan 9 from Bell Labs. A seq command appeared in NetBSD 3.0. This command was based on the command of the
same name in Plan 9 from Bell Labs and the GNU core utilities. The GNU seq command first appeared in the 1.13 shell utilities release.
BUGS
The -w option does not handle the transition from pure floating point to exponent representation very well. The seq command is not bug for
bug compatible with the Plan 9 from Bell Labs or GNU versions of seq.
BSD
May 27, 2010 BSD