Sponsored Content
Full Discussion: Lists in awk
Top Forums UNIX for Dummies Questions & Answers Lists in awk Post 302855137 by krishmaths on Thursday 19th of September 2013 06:23:41 AM
Old 09-19-2013
Code:
awk '{sum+=$2;a[++i]=$1} END{for (i in a) {print a[i]"/"sum}}'  infile

This User Gave Thanks to krishmaths For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question on lists

I'm fairly new to shell scripting and would like to know if what I am seeking to do is possible in shell. I'm trying to make a list of strings. The list will be looped through and each member of the list will be used to pass a parsing option to python. My script looks something like this: ... (3 Replies)
Discussion started by: Nacre
3 Replies

2. AIX

grep using lists?

I have a file that contain a list of files. How can I use grep to search the files in the list for a specific pattern? (2 Replies)
Discussion started by: bbbngowc
2 Replies

3. Programming

C++ programming using lists

To test this program it must create 2 integer lists - list1, list2 - and then read and process a series of list commands from a file named "data.txt". Each command and any associated values, list number, value appears on a separate line. All I can do is get it to input the integers and then... (3 Replies)
Discussion started by: tiger13e
3 Replies

4. Shell Programming and Scripting

Shell Script to Create non-duplicate lists from two lists

File_A contains Strings: a b c d File_B contains Strings: a c z Need to have script written in either sh or ksh. Derive resultant files (File_New_A and File_New_B) from lists File_A and File_B where string elements in File_New_A and File_New_B are listed below. Resultant... (7 Replies)
Discussion started by: mlv_99
7 Replies

5. Shell Programming and Scripting

Using foreach with two lists

Hi everybody, I'm trying to use a foreach command with two lists. The file.txt looks like this: var1: 100 200 300 var2: 3 6 9 I'm trying to use a foreach command to associate the two variables together. My script looks like this: #! /bin/tcsh set a=(`cat file.txt | grep 'var1' | cut -d... (8 Replies)
Discussion started by: SimonWhite
8 Replies

6. Shell Programming and Scripting

combining two lists

Hi, So I I received two lists for my merchandise and both are similar but differences do occur. I want to combine two lists that have similar names but I dont want the similar name to come up twice because I will end up purchasing two of those items. Heres an example below (file is massive). ... (1 Reply)
Discussion started by: kylle345
1 Replies

7. Shell Programming and Scripting

get the lists

I expert, I may cross post something similar but I dirtyed my quesion somehow to be clear in the thread #cat file1 88dee gcc: Grok for callconvention-hard to enable hard float a2ad2 eglibc: package mtrace separately 61487 python: bump PR of packages after update of distutils.bbclass... (1 Reply)
Discussion started by: yanglei_fage
1 Replies

8. Shell Programming and Scripting

Issue with Lists

Hey guys, so I wrote this simple script. The first time I typed it all out, I had the issue where whatever choice I entered, it would simply tell me it was a "bad selection" aka the else output. I redid everything, and now no matter the choice, it does the backup option.. My brain hurts, and... (12 Replies)
Discussion started by: jakelawson44
12 Replies

9. Shell Programming and Scripting

Sed/awk to tell differences between two lists

Greetings all, I have two output lists from a log that I am working with. Below are the examples. except, the lists are in the thousands. list1.out FEA1234 FEA4343 FEA3453 FEA3413 FEA34A3 FEA3433 .... list2.out FEA1235 (3 Replies)
Discussion started by: jeffs42885
3 Replies

10. Shell Programming and Scripting

Combining lists

Hello everybody. My operating system is Fedora30, shell - bash I faced combining lists. I will be glad for help regarding strings, arrays and so on. The bottom line is as follows. It is necessary to combine each element from the first list with elements from the second. if the second is longer... (4 Replies)
Discussion started by: nezabudka
4 Replies
sum(n)									sum								    sum(n)

NAME
sum - calculate a sum(1) compatible checksum SYNOPSIS
package require Tcl 8.2 package require sum ?1.0? ::crc::sum ?-format format? message ::crc::sum ?-format format? -filename file DESCRIPTION
This package provides a Tcl-only implementation of the sum(1) command which calculates a 16 bit checksum value from the input data. The BSD sum algorithm is used by default but the SysV algorithm is also available. COMMANDS
::crc::sum ?-format format? message ::crc::sum ?-format format? -filename file The command takes string data or a file name and returns a checksum value calculated using the sum(1) algorithm. The result is for- matted using the format(n) specifier provided or as an unsigned integer (%u) by default. OPTIONS
-filename name Return a checksum for the file contents instead of for parameter data. -format string Return the checksum using an alternative format template. EXAMPLES
% crc::sum "Hello, World!" 37287 % crc::sum -format 0x%X "Hello, World!" 0x91A7 % crc::sum -file sum.tcl 13392 SEE ALSO
sum(1), cksum(n), crc32(n) AUTHORS
Pat Thoyts KEYWORDS
sum, cksum, checksum, crc, crc32, cyclic redundancy check, data integrity, security crc 1.0 sum(n)
All times are GMT -4. The time now is 12:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy