Sponsored Content
Top Forums Shell Programming and Scripting Get 20% of lines in File randomly Post 302719201 by chercheur857 on Monday 22nd of October 2012 08:37:47 AM
Old 10-22-2012
Thank you Lem so much for help,
i try to test your script on this file:
Code:
xxxxxxxx-94.yyyyy.zzzzzzzz.aa
xxxxxxxx-95.yyyyy.zzzzzzzz.aa
xxxxxxxx-96.yyyyy.zzzzzzzz.aa
xxxxxxxx-97.yyyyy.zzzzzzzz.aa
xxxxxxxx-98.yyyyy.zzzzzzzz.aa

i run
Code:
./prog.sh  file.txt 50 94 97

it display:
Code:
4	### xxxxxxxx-97.yyyyy.zzzzzzzz.aa
3	### xxxxxxxx-96.yyyyy.zzzzzzzz.aa

have you an idea please ? i'm so sorry if i disturb you
Thank you so much
BestRegards

Last edited by Scott; 10-22-2012 at 09:52 AM.. Reason: For the LAST time.... CODE TAGS
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to select a value randomly

on my desktop i am using the kde rotating desktop image option. this rotates images randomly every half hour. now, i would like to write an html file which will have an inline frame with some text, maybe system messages, or my friends live journal thati read alot, or unix.com! however, i dont want... (1 Reply)
Discussion started by: norsk hedensk
1 Replies

2. Shell Programming and Scripting

Read line from file randomly

I have data file with customer.dat, and this contains the customer names >cat customer.dat FirstName1 LastName1 FistName2 LastName1 FistName3 MiddleName3 LastName3 This file can contain areoun 100 customer names. Regards, (1 Reply)
Discussion started by: McLan
1 Replies

3. Shell Programming and Scripting

use awk to read randomly located columns in an excel file

Hi, I have an excel file that have a random count of columns/fields and what im trying to do is to only retrieve all the rows under 2 specific field headers. I can use the usually command for awk which is awk 'print{ $1 $2}' > output.txt, but the location of the 2 specific field headers is... (9 Replies)
Discussion started by: mdap
9 Replies

4. UNIX for Dummies Questions & Answers

randomly renaming files

I have a directory of files that look like filename 001.ext, filename 002.ext, etc. I'd like to rename the files with unique random numbered names, so that the original filenames are stripped and the files are given a new, random number name. I'm not super new to UNIX, but I don't often use it for... (2 Replies)
Discussion started by: platz
2 Replies

5. Shell Programming and Scripting

Cron job randomly once a day

I want to create a cron job randomly once a day for my site's registration. The responsible file for registrations is a config file and I need to change the contents twice on day (on and off) I know the way for random cron job for example */n * * * * /usr/local/bin/php... (6 Replies)
Discussion started by: lucker
6 Replies

6. Programming

Java application dying randomly

Hi, (First post, please be gental!) I have a java app that I am running on unix (centos) But it keeps dying randomly. The times seem random from anything between 3 hours and 3 days. I have a cronjob running to restart it when ever it dies but I would rather this happened less often. ... (2 Replies)
Discussion started by: sm9ai
2 Replies

7. UNIX for Dummies Questions & Answers

How to randomly select lines from a text file

I have a text file with 1000 lines, I want to randomly select 200 lines from it and print them as output. How do I go about doing that? Thanks! (7 Replies)
Discussion started by: evelibertine
7 Replies

8. Shell Programming and Scripting

Randomly inserting extra columns into csv file

Hi Tech Guru, I have a test file as below , which needs some more fields to be populated randomly : dks3243;12;20130823;1420;25m;0;syt dks3243;rocy;10 dks3243;kiop;18 sde21p4;77;20151210;8479;7py;9;vfr sde21p4;temp;67 sfq6i01;12;20120123;3412;4rd;7;jui sfq6i01;uymk;90 sfq6i01;kiop;51 ... (8 Replies)
Discussion started by: Lokesha
8 Replies

9. Shell Programming and Scripting

Randomly create time in UNIX

Hey, How can i create randomly create time N times. Suppose i want to create data for a particualr date 5 times... Mon Jan 19 11:42:50 Mon Jan 19 19:16:40 Mon Jan 19 12:12:33 Mon Jan 19 14:26:27 Mon Jan 19 12:29:53 Mon Jan 19 13:30:31 I want the script to create N times randome... (2 Replies)
Discussion started by: jaituteja
2 Replies

10. Shell Programming and Scripting

How to select lines randomly without replacement in UNIX?

Dear Folks I have one column of 15000 lines and want to select randomly 5000 of them in five different times without replacement. I am aware that command 'shuf' and 'sort -R' could select randomly those lines but I am not sure how could I avoid the replacement of selection line. Does anyone have... (10 Replies)
Discussion started by: sajmar
10 Replies
LDIF2DB.PL(8)						      System Manager's Manual						     LDIF2DB.PL(8)

NAME
ldif2db.pl - Directory Server perl script for importing a LDIF file SYNOPSIS
ldif2db.pl -n backend [-Z serverID] [-D rootdn] { -w password | -w - | -j filename } [-P protocol] {-s includeSuffix}* [{-x excludeSuf- fix}*] [-O] [-c chunksize] [-v] [-h] [-g [string]] [-G namespace_id] {-i filename}* DESCRIPTION
Imports LDIF file(s) into the server. Either the option '-n' or '-s' must be used. This script creates an entry in the directory that launches this dynamic task. OPTIONS
A summary of options is included below: -Z Server Identifier The server ID of the Directory Server instance. If there is only one instance on the system, this option can be skipped. -D Root DN The Directory Manager DN, or root DN. If not specified, the script will search the server instance configuration for the value. -w password The rootdn password. -w - Prompt for the rootdn password. -j password filename The name of the file that contains the root DN password. -n Backend Name The name of the LDBM database to restore. Example: userRoot -s includeSuffix Specifies the suffixes to be included or specifies the subtrees to be included. -x excludeSuffix Specifies the suffixes to be excluded or specifies the subtrees to be excluded. -i filename Name for the LDIF file to import. -g [string] Generates a unique ID. Type none for no unique ID to be generated and deterministic for the generated unique ID to be name-based. By default, a time-based unique ID is generated. When using the deterministic generation to have a name-based unique ID, it is also possible to specify the namespace for the server to use, as follows: -g deterministic namespaceId namespaceId is a string of characters in the format 00-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx. -G namespace_id Generates a namespace ID as a name-based unique ID. This is the same as specifying the -g deterministic option. -P Protocol The connection protocol to connect to the Directory Server. Protocols are STARTTLS, LDAPS, LDAPI, and LDAP. If this option is skipped, the most secure protocol that is available is used. For LDAPI, AUTOBIND is also available for the root user. -O Requests that only the core database is created without attribute indexes. -c Chunk size The number of entries to process before starting a fresh pass during the import. By default this is handled internally by the server. -v Display verbose ouput -h Display usage EXAMPLE
ldif2db.pl -Z instance1 -n userRoot -i /LDAP/ldif/data.ldif ldif2db.pl -s "dc=example,dc=com" -i /LDAP/ldif/data.ldif -D 'cn=directory manager' -w password -P STARTTLS Note: security must be enabled to use protocol STARTTLS. If STARTTLS is not available it will default to next strongest/available protocol automatically. DIAGNOSTICS
Exit status is zero if no errors occur. Errors result in a non-zero exit status and a diagnostic message being written to standard error. AUTHOR
ldif2db.pl was written by the 389 Project. REPORTING BUGS
Report bugs to http://bugzilla.redhat.com. COPYRIGHT
Copyright (C) 2013 Red Hat, Inc. Mar 5, 2013 LDIF2DB.PL(8)
All times are GMT -4. The time now is 03:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy