Sponsored Content
Top Forums Shell Programming and Scripting choose random text between constant string.. using awk? Post 302394985 by ironmask2004 on Sunday 14th of February 2010 06:48:55 AM
Old 02-14-2010
Quote:
Originally Posted by sandwich
Very nice ironmask2004 it is great too ....

I have just finished it with the previous solution
vtip=$RANDOM
let "vtip=1+(vtip%2125)"
awk -v cislo=$vtip '/%/{p++;next}p==cislo' vtipy.txt

but you need to know how muche recoreds you have insaide the fill to generate a random number betwwen 1 and NUM Of Rec !!!
 

8 More Discussions You Might Find Interesting

1. Programming

'strlen' of a constant string

In a declaration, I have: const char comment_begin = "<!--"; const char comment_end = "-->"; const int comment_begin_len = strlen(comment_begin); const int comment_end_len = strlen(comment_end); When I compile, I get the warnings: emhttpc.c:64: warning: initializer element is not... (10 Replies)
Discussion started by: cleopard
10 Replies

2. Shell Programming and Scripting

How to insert some constant text at beginig of each line within a text file.

Dear Folks :), I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp. I can do this in vi editor by using this command :g/^/s//BBB_ e,g I have a file named as Test.dat and it containins below text: michal... (4 Replies)
Discussion started by: Muhammad Afzal
4 Replies

3. Shell Programming and Scripting

using awk to extract text between two constant strings

Hi, I have a file from which i need to extract data between two constant strings. The data looks like this : Line 1 SUN> read db @cmpd unit 60 Line 2 Parameter: CMPD -> "C00071" Line 3 Line 4 SUN> generate Line 5 tabint>ERROR: (Variable data) The data i need to extract is... (11 Replies)
Discussion started by: mjoshi
11 Replies

4. Shell Programming and Scripting

Extract text between two specified "constant" texts using awk

Hi All, From the title you may know that this question has been asked several times and I have done lot of Googling on this. I have a Wikipedia dump file in XML format. All the contents are in one XML file i.e. all different topics have been put in one XML file. Now I need to separate them and... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

5. Shell Programming and Scripting

how to choose random columns

Hello! Can anybody suggest about the fastest way of extracting "n" random columns from a very large file (tab separated) having thousands of columns, where n can be any specified number. Thanks! (10 Replies)
Discussion started by: mira
10 Replies

6. Shell Programming and Scripting

How to solve awk: line 1: runaway string constant error?

Hi All ! I am just trying to print bash variable in awk statement as string here is my script n=1 for file in `ls *.tk |sort -t"-" -k2n,2`; do ak=`(awk 'FNR=='$n'{print $0}' res.dat)` awk '{print "'$ak'",$0}' OFS="\t" $file n=$((n+1)) unset ak doneI am getting following error awk:... (7 Replies)
Discussion started by: Akshay Hegde
7 Replies

7. Programming

String Constant C

I wonder string constant exists permanently or temporary. For example, printf("hello, world"); the function printf access to it is through a pointer. Does it mean storage is allocated for the string constant to exist permanently in memory? :confused: (4 Replies)
Discussion started by: kris26
4 Replies

8. Shell Programming and Scripting

Script that will random choose an IP address

Hi, I need to write a bash script that will random choose and login into these below ip addresses. 192.168.116.130 192.168.116.131 192.168.116.132 192.168.116.133 I'm new into scripting and I need to enhance my logic. Below is what i did ... (4 Replies)
Discussion started by: Milon
4 Replies
mlib_ImageColorRGB2CIEMono(3MLIB)			    mediaLib Library Functions				 mlib_ImageColorRGB2CIEMono(3MLIB)

NAME
mlib_ImageColorRGB2CIEMono - RGB to monochrome conversion SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_ImageColorRGB2CIEMono(mlib_image *dst, const mlib_image *src); DESCRIPTION
The mlib_ImageColorRGB2CIEMono() function performs a conversion from a red/green/blue to a monochromatic image. The source image must be a three-channel image. The destination image must be a single-channel image. It uses the following equation: dst[x][y][0] = 0.2125*src[x][y][0] + 0.7154*src[x][y][1] + 0.0721*src[x][y][2] PARAMETERS
The function takes the following arguments: dst Pointer to destination image. src Pointer to source image. RETURN VALUES
The function returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_ImageColorRGB2CIEMono_Fp(3MLIB), mlib_ImageColorRGB2Mono(3MLIB), mlib_ImageColorRGB2Mono_Fp(3MLIB), attributes(5) SunOS 5.10 10 Nov 2004 mlib_ImageColorRGB2CIEMono(3MLIB)
All times are GMT -4. The time now is 03:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy