can someone tell me how can I insert a word in front of each line in a file.
i tried with sed but didn't managed yet.
Is there another command or this one(sed) works?
10x anyway. (7 Replies)
Hello all
im doing simple parsing on text file , but now I need to insert
string before the first line of the text file , how can I do that in perl? (3 Replies)
Greetings.
I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file.
I'm struggling to see how each line can be... (5 Replies)
Hi folks,
have a look into the attachment, i am not familiar with unix, can you please help me in this regard.
thanks in advance, :)
regards,
Geeko (4 Replies)
Hi All,
I have a file like this,
data1,data2,,,data5,data6.
i want to write a shell script to replace data3 with "/example/string". which means my data file should look like this .
data1,data2,example/string],,data5,data6.
Could you guys help me to get a sed command or any other command... (8 Replies)
FOLKS ,
i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one.
thanks...
Venu (3 Replies)
Hi, Perl is new to me. I am trying to insert a line to a file.
Example: I have a file (trial.txt), content:
ZZZZ
AAA
DDDD
I am trying to insert CCC below AAA.
MY perl command:
open (FILE,"+>>C:\\Documents and Settings\\trial.txt\n")|| die "can't open file";
while(<FILE>)
{ ... (6 Replies)
HI,
I have a text file in which I have removed all new lines as I would like to introduce a new line at the end of each record in the file. There is no common end line for all the records. A new record will start by *RECORD*. So I want to introduce a new line before this line *RECORD*. So Can... (2 Replies)
Hello,
I am looking to automate a task - which is updating an existing access control instruction of a server and making sure that the attributes defined in the instruction is in sorted order. The instructions will be of a specific syntax.
For example lets assume below listed is one of an... (6 Replies)
Discussion started by: sanjayroc
6 Replies
LEARN ABOUT DEBIAN
data::random::wordlist
Data::Random::WordList(3pm) User Contributed Perl Documentation Data::Random::WordList(3pm)NAME
Data::Random::WordList - Perl module to get random words from a word list
SYNOPSIS
use Data::Random::WordList;
my $wl = new Data::Random::WordList( wordlist => '/usr/share/dict/words' );
my @rand_words = $wl->get_words(10);
$wl->close();
DESCRIPTION
Data::Random::WordList is a module that manages a file containing a list of words.
The module expects each line of the word list file to contain only one word. It could thus be easily used to select random lines from a
file, but for coherency's sake, I'll keep referring to each line as a word.
The module uses a persistent filehandle so that there isn't a lot of overhead every time you want to fetch a list of random words.
However, it's much more efficient to grab multiple words at a time than it is to fetch one word at a time multiple times.
The module also refrains from reading the whole file into memory, so it can be safer to use with larger files.
METHODS
new()
Returns a reference to a new Data::Random::WordList object. Use the "wordlist" param to initialize the object:
o wordlist - the path to the wordlist file. If a path isn't supplied, the wordlist distributed with this module is used.
get_words([NUM])
NUM contains the number of words you want from the wordlist. NUM defaults to 1 if it's not specified. get_words() dies if NUM is greater
than the number of words in the wordlist. This function returns an array or an array reference depending on the context in which it's
called.
close()
Closes the filehandle associated with the word list. It's good practice to do this every time you're done with the word list.
VERSION
0.07
AUTHOR
Originally written by: Adekunle Olonoh
Currently maintained by: Buddy Burden (barefoot@cpan.org), starting with version 0.06
COPYRIGHT
Copyright (c) 2000-2011 Adekunle Olonoh. All rights reserved. This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
Data::Random
perl v5.14.2 2012-06-04 Data::Random::WordList(3pm)