Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Retrieving random numbers out of a text file Post 302267527 by vgersh99 on Friday 12th of December 2008 03:15:21 PM
Old 12-12-2008
Code:
$ cat tempIP
    6643 total packets received
    6718 total packets received
    7293 total packets received
    7785 total packets received

Code:
nawk 'FNR%2 {o=$1;next} {printf("%d - %d = %d\n", o, $1, o-$1)}' tempIP

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sed - Replacing numbers w/asteriks in random location in a file

I have a file which contains lots of text (comment field). I would like to parse through the comment field which can be up to 255 characters long and look for anything that seems to resemble, say, a credit card number or customer account number, etc. and replace the numbers with asteriks (*). ... (9 Replies)
Discussion started by: giannicello
9 Replies

2. UNIX for Dummies Questions & Answers

Random numbers without repetition

Is anyone know some scripts to generate random number without repetition using bash; for example generate 10 different random numbers. Thanks (8 Replies)
Discussion started by: asal_email
8 Replies

3. Shell Programming and Scripting

random select text file ranamed

i want to need script.. source.txt /home/user1/public_html/test3 /home/user90/public_html/test9 . . . /home/user650/public_html/test000 read source.txt and cd /home/user**/public_html/*** and there is 1.txt, 2txt ~~25.txt and select 6 text files randomly among the... (4 Replies)
Discussion started by: topic32428285
4 Replies

4. Shell Programming and Scripting

Random word from a flat text file

Hello, I need to take a random word from a flat text file with words in it seperated by spaces. The code I am using, always gives me the first word. Can anyone please shed some light on this. Here's my code. Thanks echo table roof ceiling jar computer monitor keyboard carpet >... (5 Replies)
Discussion started by: Freakhan
5 Replies

5. Shell Programming and Scripting

Read random line from a text file

I have a text file with hundreds of lines, i wish to run a script and reads a random line to pass it to another command line such as: for line in `cat file |grep random line`; do echo $line |mail my@example.com ; done thank you (6 Replies)
Discussion started by: Bashar
6 Replies

6. Shell Programming and Scripting

Help in retrieving the ending line numbers of the functions

Hi! I've a C file which consist of many function definitions with numbers at the beginning as shown below.. 10 void search() 11 { 12 /*body 14 * 15 * 17 * 18 * 40 * 42 * 60 } 90 void func_name() 95 { 99 /*body 100 * 105 * 111 * (7 Replies)
Discussion started by: abk07
7 Replies

7. UNIX for Dummies Questions & Answers

Extracting lines from a text file based on another text file with line numbers

Hi, I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

8. Shell Programming and Scripting

Retrieving values from a line in text file

Hi, I am new to Unix/ksh script and will like to check how do I retrieve just the count of '258' in the last line in a text file ? There will be this "TRL" appended with number of count at the last line in a text file . TRL0000000258 var=`grep 'TRL' $HOME/folder/test.txt | wc -l` ... (12 Replies)
Discussion started by: snowfrost
12 Replies

9. Homework & Coursework Questions

Random numbers

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! Write a shell script that will take the sum of two random number? Ex: Random n1 +Random n2 = result i tries to write it but i had some dufficulties ... (3 Replies)
Discussion started by: renegade755
3 Replies
AECHO(1)						      General Commands Manual							  AECHO(1)

NAME
aecho - send AppleTalk Echo Protocol packets to network hosts SYNOPSIS
aecho [ -c count ] ( address | nbpname ) DESCRIPTION
aecho repeatedly sends an Apple Echo Protocol (AEP) packet to the host specified by the given AppleTalk address or nbpname and reports whether a reply was received. Requests are sent at the rate of one per second. address is parsed by atalk_aton(3). nbpname is parsed by nbp_name(3). The nbp type defaults to `Workstation'. When aecho is terminated, it reports the number of packets sent, the number of responses received, and the percentage of packets lost. If any responses were received, the minimum, average, and maximum round trip times are reported. EXAMPLE
Check to see if a particular host is up and responding to AEP packets: example% aecho bloodsport 11 bytes from 8195.13: aep_seq=0. time=10. ms 11 bytes from 8195.13: aep_seq=1. time=10. ms 11 bytes from 8195.13: aep_seq=2. time=10. ms 11 bytes from 8195.13: aep_seq=3. time=10. ms 11 bytes from 8195.13: aep_seq=4. time=10. ms 11 bytes from 8195.13: aep_seq=5. time=9. ms ^C ----8195.13 AEP Statistics---- 6 packets sent, 6 packets received, 0% packet loss round-trip (ms) min/avg/max = 9/9/10 OPTIONS
-c count Stop after count packets. SEE ALSO
ping(1), atalk_aton(3), nbp_name(3), atalkd(8). netatalk 1.2 17 Dec 1991 AECHO(1)
All times are GMT -4. The time now is 05:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy