09-16-2009
Perl : Search for next occurence of a word in an array
I have an array as follows:
Space: ABC
Name: def
Age: 22
Type: new
Name: fgh
Age: 34
Type: old
Space: XYZ
Name: pqr
Age: 44
Type: new
:
:
How can I separate the array with elements starting from Space:ABC until Space: XYZ & put them in a different array & so on...
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Greetings,
I need to search and count all the occurences of a word in all the files in a directory.
Any suggestions greatly appreciated.
Thanks (1 Reply)
Discussion started by: skoppana
1 Replies
2. Shell Programming and Scripting
Hi
I need a perl onliner which seaches a line starting with a pattern(last occurence) and display it.
similar to
grep 'pattern' filename | tail -1 in UNIX
Ex: I want to display the line starting with "cool" and which is a last occurence
adadfadafadf
adfadadf
cool dfadfadfadfara... (4 Replies)
Discussion started by: ammu
4 Replies
3. Shell Programming and Scripting
Just wondering if there's a better way to get these complete sentences into an array and keep the quotes intact? All the quotes make it look ugly to me but it works. I want to be able to refer to the full sentences by index. I've tried a few qw and qq/ aproaches but what I have below seems about... (4 Replies)
Discussion started by: gctaylor
4 Replies
4. UNIX for Dummies Questions & Answers
In a file I have to count a particular word. like i need apache how many times.
I tried this
$ tr "\011" "\012\012"<foo1 | tr -cd "" |sort\uniq -c
but I got result like this
32 apache
18 dns
12 doctor
Please sugest me (4 Replies)
Discussion started by: pranabrana
4 Replies
5. Shell Programming and Scripting
Hi All
I want to search a string from an array in Perl. If a match occurs, assign that string to a variable else assign 'No match'. I tried writing the script as follows but it's in vain. Please help me..
#!/usr/bin/perl
use strict;
my $NER;
my @text=("ORG","PER");
... (4 Replies)
Discussion started by: my_Perl
4 Replies
6. Shell Programming and Scripting
I'm trying to have my perl script telnet into the network device execute a command then dump the output of the command into a variable. The script then greps for the word "STANDBY". I can't seem to get the script to print out the output because it seems that the script can't find the word... (1 Reply)
Discussion started by: xmaverick
1 Replies
7. Shell Programming and Scripting
Hello,
Question is related to Perl:
I need to search few of the files from the array of file names.
And after grepping the file names from an array I need to link these files to original location. The original location in this case is ref_path as input from the user.
##$ref_path is... (3 Replies)
Discussion started by: aarora1
3 Replies
8. UNIX and Linux Applications
Hi,
I want the Perl script with versions 5.8.2 and 5.8.5 starting with
#!/usr/bin/perl
The Perl program should read the excel file or text file line by line and taking into an array and search in the UNIX directories for reference file of .jsp or .js or .xsl with path .The Object names... (2 Replies)
Discussion started by: pasam
2 Replies
9. Shell Programming and Scripting
Hi ,
I have been trying to write a perl script to do this job. But i am not able to achieve the desired result. Below is my code.
my $current_value=12345;
my @users=("bob","ben","tom","harry");
open DBLIST,"<","/var/tmp/DBinfo";
my @input = <DBLIST>;
foreach (@users)
{
my... (11 Replies)
Discussion started by: chidori
11 Replies
10. UNIX for Advanced & Expert Users
Hi,
i want to search and replace array values by using perl
perl -pi -e "s/${d$i]}/${b$j]}" *.xml
i am using while loop for the same. if i excute this,it shows "Substitution replacement not terminated at -e line 1.".
please tell me what's wrong this line (1 Reply)
Discussion started by: arindam guha
1 Replies
LEARN ABOUT DEBIAN
language::intercal::charset::baudot
INTERCAL::Charset::Baudot(3pm) User Contributed Perl Documentation INTERCAL::Charset::Baudot(3pm)
NAME
Charset::Baudot - allows to use Baudot string constants in ASCII programs (and v.v.)
SYNOPSIS
use Charset::Baudot 'baudot2ascii';
my $a = baudot2ascii"(Baudot text)";
DESCRIPTION
Charset::Baudot defines functions to convert between a subset of ASCII and a subset of nonstandard Baudot - the original Baudot allows only
letters, numbers, and some punctuation. We assume that a "Shift to letters" code while already in letters mode means "Shift to lowercase"
and "Shift to figures" while already in figures mode means "Shift to symbols". This allows to use up to 120 characters. However, for sim-
plicity some characters are available in multiple sets, so the total is less than that.
Two functions, baudot2ascii and ascii2baudot, are exportable (but not exported by default). They do the obvious thing to their first argu-
ment and return the transformed string.
BAUDOT CHARACTER TABLE
The following are the characters recognised. As described, the "shift" characters have nonstandard meaning.
set Letters Lowercase Figures Symbols
code
00 N/A N/A N/A N/A
01 E e 3 Cents
02 L/F L/F L/F L/F (line feed)
03 A a - +
04 Space Space Space Tab
05 S s BELL
06 I i 8 #
07 U u 7 =
08 C/R C/R C/R C/R (carriage return)
09 D d $ *
10 R r 4 {
11 J j ' ~
12 N n , XOR
13 F f ! |
14 C c : ^
15 K k ( <
16 T t 5 [
17 Z z " }
18 W w ) >
19 L l 2 ]
20 H h N/A backspace
21 Y y 6 @
22 P p 0 N/A
23 Q q 1 POUND
24 O o 9 NOT
25 B b ? delete
26 G g & N/A
27 Figures Figures Symbols Symbols
28 M m . %
29 X x / _
30 V v ; N/A
31 Lowercase Lowercase Letters Letters
COPYRIGHT
This module is part of CLC-INTERCAL.
Copyright (C) 1999, 2000, 2002, 2006, 2007 Claudio Calvelli, all rights reserved
See files README and COPYING in the distribution for information.
SEE ALSO
A qualified psychiatrist.
perl v5.8.8 2008-03-29 INTERCAL::Charset::Baudot(3pm)