Sponsored Content
Top Forums Shell Programming and Scripting Using awk to summing from a given line Post 302686773 by guruprasadpr on Wednesday 15th of August 2012 11:26:00 AM
Old 08-15-2012
Hi

Code:
$ awk 'NR>=10 && NR<=20{x+=$0;}END{print x}' file
21.373

Guru.
This User Gave Thanks to guruprasadpr For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk scripting - matching records and summing up time

Hello. I just found out about awk, and it appears that this could handle the problem I'm having right now. I first stumbled on the thread How to extract first and last line of different record from a file, and that problem is almost similar to mine. In my case, an ASCII file will contain the... (0 Replies)
Discussion started by: Gonik
0 Replies

2. Shell Programming and Scripting

Awk: Summing values with group criteria

Hi Guys, I have a text file with ";" like separator F1;F2;F3;F4;F5 444;100041;IT;GLOB;1800000000 444;100041;TM;GLOB;1000000000 444;10300264;IT;GLOB;2000000000 444;10300264;IT;GLOB;2500000000 I have to sum the cullums F5 for same F2 and F3 collums The result must be: ... (7 Replies)
Discussion started by: gianluca2
7 Replies

3. Shell Programming and Scripting

Reading several files and summing their content line-by-line

Hey, I am gettin a bit crazy with my script. I have several input datas with the same name (5.ill) in different folders (daysim_01, daysim_02, etc.). The 4. column of each of the data has to be summed with each other and then hass to be written in one new file. So file1: 1 1 0 1 2 1 1 2 ... (7 Replies)
Discussion started by: ergy1983
7 Replies

4. Shell Programming and Scripting

Summing up a matrix using awk

Hi there, If anyone can help me sorting out this small task would be great. Given a matrix like the following: 100 3 3 3 3 3 ... 200 5 5 5 5 5 ... 400 1 1 1 1 1 ... 500 8 8 8 8 8 ... 900 0 0 0 0... (5 Replies)
Discussion started by: JRodrigoF
5 Replies

5. Shell Programming and Scripting

Summing data on N. row of each line

Hi friends, lets assume that I have lines of data as follows rico 12 bct 58 pot 65 vft 41 dek 45 kbt 13 her 35 ubr 14 . . . . . . . . . . . . I want to calculate the sum of the numbers at the 2. row of each... (6 Replies)
Discussion started by: rpf
6 Replies

6. Shell Programming and Scripting

Please Help!!!! Awk for summing columns based on selected column value

a,b,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii a thru ii are digits and strings.... The awk needed....if coloumn 9 == i (coloumn 9 is string ), output the sum of x's(coloumn 22 ) in all records and sum of y's (coloumn 23 ) in all records in a file (records.txt).... (6 Replies)
Discussion started by: BrownBob
6 Replies

7. Shell Programming and Scripting

awk summing specific lines and fields

Hi I would like to know if it is possible to sum some specific fields. I have this x;x;x;x;x;x;x;x;467,390,611 Bytes;0.435291 GB;0.062247 GB;0.373045 GB;11,225;157 a;a;a;a;a;a;a;a;13,805,156,846 Bytes;12.857054 GB;1.838559 GB;11.018495 GB;151,063;18,933 b;b;b;b;b;b;b;b;232,797,478,723... (5 Replies)
Discussion started by: nakaedu
5 Replies

8. Shell Programming and Scripting

Summing columns in line

I have a file with the following format AAAAA 1.34B 0.76B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.00B 0.90B 0.00B 0.00B 0.46B 0.00B 0.03B 0.00B ... (4 Replies)
Discussion started by: ncwxpanther
4 Replies

9. Shell Programming and Scripting

Help summing a file using awk

I'm trying to sum a text file using AWK. Here is an example of the file: 600|3H68| 46 600|3H69| 46 600|3H6F| 290 600|3H6G| 24 600|3HDY| 1 600|3HDY| 3 600|3HE0| 1 600|3HE0| 3 I would like to sum the third field if the first... (7 Replies)
Discussion started by: Drenhead
7 Replies

10. Shell Programming and Scripting

awk split columns after matching on rows and summing the last column

input: chr1 1 2 3 chr1 1 2 4 chr1 2 4 5 chr2 3 6 9 chr2 3 6 10 Code: awk '{a+=$4}END{for (i in a) print i,a}' input Output: chr112 7 chr236 19 chr124 5 Desired output: chr1 1 2 7 chr2 3 6 19 chr1 2 4 5 (1 Reply)
Discussion started by: jacobs.smith
1 Replies
Net::DHCP::Constants(3pm)				User Contributed Perl Documentation				 Net::DHCP::Constants(3pm)

NAME
Net::DHCP::Constants - Constants for DHCP codes and options SYNOPSIS
use Net::DHCP::Constants; print "DHCP option SUBNET_MASK is ", DHO_SUBNET_MASK(); DESCRIPTION
Represents constants used in DHCP protocol, defined in RFC 1533, RFC 2132, RFC 2241, RFC 2485, RFC 2563, RFC 2937, RFC 3004, RFC 3011, RFC 3046. TAGS
As mentioned above, constants can either be imported individually or in sets grouped by tag names. The tag names are: o bootp_codes Imports all of the basic BOOTP constants.(01) BOOTREQUEST(02) BOOTREPLY o htype_codes Imports all HTYPE (hardware address type) codes.(01) HTYPE_ETHER(06) HTYPE_IEEE802(08) HTYPE_FDDI Most common value is HTYPE_ETHER for "Ethernet". o dhcp_message Import all DHCP Message codes. (rfc2132) (01) DHCPDISCOVER(02) DHCPOFFER(03) DHCPREQUEST(04) DHCPDECLINE(05) DHCPACK(06) DHCPNAK(07) DHCPRELEASE(08) DHCPINFORM(09) DHCPFORCERENEW (rfc4388) (10) DHCPLEASEQUERY(11) DHCPLEASEUNASSIGNED(12) DHCPLEASEUNKNOWN(13) DHCPLEASEACTIVE Nb. Previously Cisco used 13 for DHCPLEASEQUERY. If you need to decode or encode packets to communicate with such a system, you might simply us the integer rather than the constant - or use the updated constant and comment in your code appropriately. o dho_codes Import all DHCP option codes.(000) DHO_PAD(001) DHO_SUBNET_MASK(002) DHO_TIME_OFFSET(003) DHO_ROUTERS(004) DHO_TIME_SERVERS(005) DHO_NAME_SERVERS(006) DHO_DOMAIN_NAME_SERVERS(007) DHO_LOG_SERVERS(008) DHO_COOKIE_SERVERS(009) DHO_LPR_SERVERS(010) DHO_IMPRESS_SERVERS(011) DHO_RESOURCE_LOCATION_SERVERS(012) DHO_HOST_NAME(013) DHO_BOOT_SIZE(014) DHO_MERIT_DUMP(015) DHO_DOMAIN_NAME(016) DHO_SWAP_SERVER(017) DHO_ROOT_PATH(018) DHO_EXTENSIONS_PATH(019) DHO_IP_FORWARDING(020) DHO_NON_LOCAL_SOURCE_ROUTING(021) DHO_POLICY_FILTER(022) DHO_MAX_DGRAM_REASSEMBLY(023) DHO_DEFAULT_IP_TTL(024) DHO_PATH_MTU_AGING_TIMEOUT(025) DHO_PATH_MTU_PLATEAU_TABLE(026) DHO_INTERFACE_MTU(027) DHO_ALL_SUBNETS_LOCAL(028) DHO_BROADCAST_ADDRESS(029) DHO_PERFORM_MASK_DISCOVERY(030) DHO_MASK_SUPPLIER(031) DHO_ROUTER_DISCOVERY(032) DHO_ROUTER_SOLICITATION_ADDRESS(033) DHO_STATIC_ROUTES(034) DHO_TRAILER_ENCAPSULATION(035) DHO_ARP_CACHE_TIMEOUT(036) DHO_IEEE802_3_ENCAPSULATION(037) DHO_DEFAULT_TCP_TTL(038) DHO_TCP_KEEPALIVE_INTERVAL(039) DHO_TCP_KEEPALIVE_GARBAGE(040) DHO_NIS_DOMAIN(041) DHO_NIS_SERVERS(042) DHO_NTP_SERVERS(043) DHO_VENDOR_ENCAPSULATED_OPTIONS(044) DHO_NETBIOS_NAME_SERVERS(045) DHO_NETBIOS_DD_SERVER(046) DHO_NETBIOS_NODE_TYPE(047) DHO_NETBIOS_SCOPE(048) DHO_FONT_SERVERS(049) DHO_X_DISPLAY_MANAGER(050) DHO_DHCP_REQUESTED_ADDRESS(051) DHO_DHCP_LEASE_TIME(052) DHO_DHCP_OPTION_OVERLOAD(053) DHO_DHCP_MESSAGE_TYPE(054) DHO_DHCP_SERVER_IDENTIFIER(055) DHO_DHCP_PARAMETER_REQUEST_LIST(056) DHO_DHCP_MESSAGE(057) DHO_DHCP_MAX_MESSAGE_SIZE(058) DHO_DHCP_RENEWAL_TIME(059) DHO_DHCP_REBINDING_TIME(060) DHO_VENDOR_CLASS_IDENTIFIER(061) DHO_DHCP_CLIENT_IDENTIFIER(062) DHO_NWIP_DOMAIN_NAME(063) DHO_NWIP_SUBOPTIONS(064) DHO_NISV3_DOMAIN(065) DHO_NISV3_SERVER(066) DHO_TFTP_SERVER(067) DHO_BOOTFILE(068) DHO_MOBILE_IP_HOME_AGENT(069) DHO_SMTP_SERVER(070) DHO_POP3_SERVER(071) DHO_NNTP_SERVER(072) DHO_WWW_SERVER(073) DHO_FINGER_SERVER(074) DHO_IRC_SERVER(075) DHO_STREETTALK_SERVER(076) DHO_STDA_SERVER(077) DHO_USER_CLASS(078) DHO_DIRECTORY_AGENT(079) DHO_SERVICE_SCOPE(080) DHO_RAPID_COMMIT(081) DHO_FQDN(082) DHO_DHCP_AGENT_OPTIONS(083) DHO_ISNS(085) DHO_NDS_SERVERS(086) DHO_NDS_TREE_NAME(087) DHO_NDS_CONTEXT(088) DHO_BCMCS_CONTROLLER_DOMAIN_NAME_LIST(089) DHO_BCMCS_CONTROLLER_IPV4_ADDRESS(090) DHO_AUTHENTICATION(091) DHO_CLIENT_LAST_TRANSACTION_TIME(092) DHO_ASSOCIATED_IP(093) DHO_CLIENT_SYSTEM(094) DHO_CLIENT_NDI(095) DHO_LDAP(097) DHO_UUID_GUID(098) DHO_USER_AUTHENTICATION_PROTOCOL(099) DHO_GEOCONF_CIVIC(100) DHO_PCODE(101) DHO_TCODE(112) DHO_NETINFO_ADDRESS(113) DHO_NETINFO_TAG(114) DHO_URL(116) DHO_AUTO_CONFIGURE(117) DHO_NAME_SERVICE_SEARCH(118) DHO_SUBNET_SELECTION(119) DHO_DOMAIN_SEARCH(120) DHO_SIP_SERVERS(121) DHO_CLASSLESS_STATIC_ROUTE(122) DHO_CCC(123) DHO_GEOCONF(124) DHO_VI_VENDOR_CLASS(125) DHO_VI_VENDOR_SPECIFIC_INFOMATION(128) DHO_ETHERBOOT_SIGNATURE(129) DHO_CALL_SERVER_ADDRESS(130) DHO_DISCRIMINATION_STRING(131) DHO_REMOTE_STATISTICS_SERVER(132) DHO_VLAN_ID(133) DHO_L2_PRIORITY(134) DHO_DSCP(135) DHO_HTTP_PROXY_FORPHONES(136) DHO_OPTION_PANA_AGENT(137) DHO_OPTION_PANA_V4_LOST(138) DHO_OPTION_CAPWAP_AC_V4(139) DHO_OPTION_IPV4_ADDRESS_MOS(140) DHO_OPTION_IPV4_FQDN_MOS(141) DHO_SIP_UA_CONFIGURATION_SERVICE_DOMAINS(150) DHO_ETHERBOOT(176) DHO_IP_TELEPHONE(177) DHO_PACKETCABLE_DEPRECATED(208) DHO_PXELINUX_MAGIC(209) DHO_CONFIGURATION_FILE(210) DHO_PATH_PREFIX(211) DHO_REBOOT_TIME(212) DHO_OPTION_6RD(213) DHO_OPTION_V4_ACCESS_DOMAIN(220) DHO_SUBNET_ALLOCATION(221) DHO_VIRTUAL_SUBNET(255) DHO_END o ccc_codes Import all CableLabs Client Configuration(001) CCC_PRIMARY_DHCP_SERVER(002) CCC_SECONDARY_DHCP_SERVER(003) CCC_PROVISIONING_SERVER(004) CCC_AS_REQ_AS_REP_BACKOFFRETRY(005) CCC_AP_REQ_AS_REP_BACKOFFRETRY(006) CCC_KERBEROS_REALM(007) CCC_TICKET_SERVER_UTILIZATION(008) CCC_PROVISIONING_TIMER(009) CCC_SECURITY_TICKET_CONTROL(010) CCC_KDC_SERVER TO DO, LIMITATIONS Automatic parsing of DHO_VENDOR_ENCAPSULATED_OPTIONS (code 43) is unsupported. Automatic parsing of DHO_NWIP_SUBOPTIONS (code 63 - rfc 2242) is unsupported. Automatic parsing of DHO_USER_CLASS (code 77 - rfc 3004) is unsupported. Automatic parsing of DHO_CCC (code 122 - rfc 3495) is unsupported. Automatic parsing of DHO_PACKETCABLE_DEPRECATED (code 177 - rfc 3495) is unsupported. SEE ALSO
Net::DHCP::Packet, Net::DHCP::Options AUTHOR
Dean Hamstead <djzort@cpan.org> and past Authors (see README) COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-08 Net::DHCP::Constants(3pm)
All times are GMT -4. The time now is 06:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy