Help with perl scripting on strings


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with perl scripting on strings
# 1  
Old 04-29-2008
Help with perl scripting on strings

Hai,

I have strings as follows.

0 INDEX MODE: ANALYZED (UNIQUE SCAN) OF 'SYS_C0030166' (INDEX (UNIQUE))


1 INDEX MODE: ANALYZED (UNIQUE SCAN) OF 'SYS_C0029845' (INDEX (UNIQUE)


9 INDEX MODE: ANALYZED (RANGE SCAN) OF 'BR_RELATED_PARTY_DETAILS_IDX1' (INDEX)


5 INDEX MODE: ANALYZED (RANGE SCAN) OF 'IM_ASSET_HOLDING_IDX2' (INDEX)


I have to extract what is present inside the single Quotes ie, i have to extract only 'SYS_C0030166', 'SYS_C0029845', 'BR_RELATED_PARTY_DETAILS_IDX1', 'IM_ASSET_HOLDING_IDX2' . I am new to perl. How do I do this in perl?
Thanks in Advance.
# 2  
Old 04-29-2008
This is one of the ways:

Code:
if ($string =~ /'([^']*)'/) {
    print $1;
}

# 3  
Old 04-29-2008
one way:

Code:
use strict;
use warnings;
my @data = ();
open (IN, 'path/to/file') or die "$!";
while(<IN>) {
   push @data,$1 if (/'([^']+)'/);
}
close IN;
print "$_\n" for @data;

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Working with strings (awk, sed, scripting, etc...)

Hi evrybody For those who are bored I suggest exercise for tail :) There is "csv" string: A,B,C,D,E,G Desired output: | (A) A | (A,B) B | (A,B,C) C | (A,B,C,D) D | (A,B,C,D,E) E | G There are no whitespace characters at the beginning and end of the line. (7 Replies)
Discussion started by: nezabudka
7 Replies

2. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

3. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

4. Shell Programming and Scripting

How to extract exact strings in shell scripting

/Path/snowbird9/nrfCompMgrRave1230100920.log.gz:09/20/2010 06:14:51 ERROR Error Message. /Path/snowbird6/nrfCompMgrRave1220100920.log.gz:09/20/2010 06:14:51 ERROR Error Message. /Path/snowbird14/nrfCompMgrRave920100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.... (0 Replies)
Discussion started by: Shirisha
0 Replies

5. What is on Your Mind?

Shell scripting vs Perl scripting

Hi all, I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first. Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies

6. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

7. Shell Programming and Scripting

How extract strings (perl)

Sample data: revision001 | some text | some text Comment: some comment Brief: 1) brief 2) brief ------------------------------------------ revision002 | some text | some text Brief: 1) brief 2) brief FIX: some fix ------------------------------------------ revision003 | some... (8 Replies)
Discussion started by: inotech
8 Replies

8. Shell Programming and Scripting

utf8 strings in Perl

Hi All I need help on how to handle utf8 strings (match, split etc.) in Perl. Thanks in advance. (2 Replies)
Discussion started by: my_Perl
2 Replies

9. Shell Programming and Scripting

Comparison of two files which contains strings using Shell scripting or PERL

Hi, I need sample code to compare the two files line by line which contains text strings and to print the difference in the third file. Thanks in advance (1 Reply)
Discussion started by: sudhakaryadav
1 Replies

10. Shell Programming and Scripting

comparison of strings in unix shell scripting

Hi STORAGE_TYPE=$1 echo "########### SQL SESSION STARTED ###########" VALUE=`sqlplus -S /nolog << THEEND connect tcupro/tcupro_dev@bdd1optn SET SERVEROUTPUT ON DECLARE V_STORAGE_TYPE varchar2(3); V_ERR_MSG varchar2(255) ; V_LOG_LEVEL varchar2(200); BEGIN... (1 Reply)
Discussion started by: piscean_n
1 Replies
Login or Register to Ask a Question