Sponsored Content
Full Discussion: Multiple number addition
Top Forums UNIX for Dummies Questions & Answers Multiple number addition Post 302484628 by m.d.ludwig on Sunday 2nd of January 2011 07:20:45 AM
Old 01-02-2011
This sounds a bit like homework :-)
Code:
#! /bin/bash

while read n; do
    (( t += n ))
    printf "      %6d\n" ${n}
done

echo '      ======'
printf "Total %6d\n" ${t}

To run:
Code:
./scriptname < inputfile

(assuming you've made the script executable and it is your current directory -- ymmv)
This User Gave Thanks to m.d.ludwig For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Number of multiple logins

How can i get the number of multiple logins of the user those are logged in currently... (1 Reply)
Discussion started by: Ramkum
1 Replies

2. Shell Programming and Scripting

number subtraction of multiple columns

I get the point of number subtraction in one column awk 'NR==1 {n=$1; next}; {n-=$1} END {print n}' inputfile but I cannot figure it out how to do this to multiple columns. awkward. (6 Replies)
Discussion started by: awkward
6 Replies

3. Shell Programming and Scripting

incremental addition of hex decimal number in one field

Hi I want to incremental add hex decimal number to a particula field in file eg: addr =123 dept1=0 addr = 345 dept2 =1 addr2 = 124 dept3 =2 . . . . . . addr3 =567 dept15 =f Is there any command which add... (8 Replies)
Discussion started by: diddi_linux
8 Replies

4. Shell Programming and Scripting

Multiple String with a number replacement and more..

Hello all, First of all, I could not made up a nice title what explains my problem in short,sorry for that already. I have the next file which contains the following, CREATE:ENTRY:\ DNAME,"referenceId=sondakika30,referenceId=User1,\ referenceId=Company,\ ... (2 Replies)
Discussion started by: sondakika
2 Replies

5. Shell Programming and Scripting

Number of occurance with multiple conditions??

Hi, I the following sample of out put: + 6.07875 10 0 cbr 210 ------- 2 10.0 2.3 1461 19715 - 6.07875 10 0 cbr 210 ------- 2 10.0 2.3 1461 19715 + 6.07875 22 0 cbr 210 ------- 2 22.0 2.9 1301 19716 - 6.07875 22 0 cbr 210 ------- 2 22.0 2.9 1301 19716 r 6.07922 0 1 cbr 210 ------- 1 30.0... (6 Replies)
Discussion started by: ENG_MOHD
6 Replies

6. Shell Programming and Scripting

Compare multiple files with multiple number of columns

Hi, input file1 abcd 123 198 xyz1:0909090-0909091 ghij 234 999 xyz2:987654:987655 kilo 7890 7990 xyz3:12345-12357 prem 9 112 xyz5:97-1134 input file2 abcd 123 198 xyz1:0909090-0909091 -9.122 0 abed 88 98 xyz1:98989-090808 -1.234 1.345 ghij 234 999 xyz2:987654:987655 -10.87090909 5... (5 Replies)
Discussion started by: jacobs.smith
5 Replies

7. Shell Programming and Scripting

Splitting of files - Addition of Page Number in the Trailer

Hi, I need your help on the following Scenario : Consider a file has 650 records and I need to split this file into 4 files having a maximum of 200 records in each of them and also for the first splitted file it should get appended with Page 1 as a trailer( Similarly for the second file, Page... (4 Replies)
Discussion started by: Ravichander
4 Replies

8. Shell Programming and Scripting

Replace column by random number addition

Here is my problem:- I have a file with pipe separated values. CR|20121021|079|ABC|N|DLS|00038|DLS|04750|1330597704|634234|634|0 CR|20121021|079|ABC|N|DLS|00038|DLS|05118|2071690102|354|351|3 CR|20121021|079|ABC|N|DLS|00038|DLS|05140|960051505|1088|1088|0... (4 Replies)
Discussion started by: Yoda
4 Replies

9. Shell Programming and Scripting

Checking File record equal to multiple of 70 or nearest number to multiple of 70

Hello, I have a file with below content - Example 3 6 69 139 210 345 395 418 490 492 I would like the result as - Multiple of 70 or nearest number in the file less than the multiple of 70 69 139 (5 Replies)
Discussion started by: Mannu2525
5 Replies

10. Shell Programming and Scripting

Removing carriage returns from multiple lines in multiple files of different number of columns

Hello Gurus, I have a multiple pipe separated files which have records going over multiple Lines. End of line separator is \n and records going over multiple lines have <CR> as separator. below is example from one file. 1|ABC DEF|100|10 2|PQ RS T|200|20 3| UVWXYZ|300|30 4| GHIJKL|400|40... (7 Replies)
Discussion started by: dJHa
7 Replies
Regexp::Common::URI::tel(3)				User Contributed Perl Documentation			       Regexp::Common::URI::tel(3)

NAME
Regexp::Common::URI::tel -- Returns a pattern for telephone URIs. SYNOPSIS
use Regexp::Common qw /URI/; while (<>) { /$RE{URI}{tel}/ and print "Contains a telephone URI. "; } DESCRIPTION
$RE{URI}{tel} Returns a pattern that matches tel URIs, as defined by RFC 2806. Under "{-keep}", the following are returned: $1 The complete URI. $2 The scheme. $3 The phone number, including any possible add-ons like ISDN subaddress, a post dial part, area specifier, service provider, etc. $RE{URI}{tel}{nofuture} As above (including what's returned by "{-keep}"), with the exception that future extensions are not allowed. Without allowing those future extensions, it becomes much easier to check a URI if the correct syntax for post dial, service provider, phone context, etc has been used - otherwise the regex could always classify them as a future extension. REFERENCES
[RFC 1035] Mockapetris, P.: DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION. November 1987. [RFC 2396] Berners-Lee, Tim, Fielding, R., and Masinter, L.: Uniform Resource Identifiers (URI): Generic Syntax. August 1998. [RFC 2806] Vaha-Sipila, A.: URLs for Telephone Calls. April 2000. SEE ALSO
Regexp::Common::URI for other supported URIs. AUTHOR
Damian Conway (damian@conway.org) MAINTAINANCE
This package is maintained by Abigail (regexp-common@abigail.be). BUGS AND IRRITATIONS
Bound to be plenty. LICENSE and COPYRIGHT This software is Copyright (c) 2001 - 2009, Damian Conway and Abigail. This module is free software, and maybe used under any of the following licenses: 1) The Perl Artistic License. See the file COPYRIGHT.AL. 2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2. 3) The BSD Licence. See the file COPYRIGHT.BSD. 4) The MIT Licence. See the file COPYRIGHT.MIT. perl v5.18.2 2013-03-08 Regexp::Common::URI::tel(3)
All times are GMT -4. The time now is 03:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy