Sponsored Content
Top Forums Shell Programming and Scripting perl lwp find word and print next word :) Post 302681847 by vogueestylee on Sunday 5th of August 2012 11:46:53 AM
Old 08-05-2012
hi, thank you for your answer but I'm not sure how to use it,

is this ok?

HTML Code:
while ($response2->content()) {  # reads STDIN, put a different handle here if you want
  if (/<div class="sender">(.*)<\/div>$/) {
    print "\"$1\"\n";   # prints with " symbols
    print "$1\n";        # prints without " symbols
  }
}
it gives me an (infinity?) errors
HTML Code:
Use of uninitialized value $_ in pattern match (m//) at p2.pl line 103, <> line 1.
so what am I doing wrong?

---------- Post updated 08-05-12 at 10:46 AM ---------- Previous update was 08-04-12 at 02:37 PM ----------

ok I got it:
PHP Code:
my $html $response2->content;
  while( 
$html =~ m/<div class="sender">(.*)<\/div>/g) {   
 
# print "\"$1\"\n"; # prints with " symbols
      
print "$1\n";  # prints without " symbols
  

thank you anyway!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find a word in a file, and change a word beneath it ??

Hi all, I have a file with lines written somewhat like this. aaaa ccc aa linux browse = no xssxw cdcedc dcsdcd csdw police dwed dwd browse = no cdecec (2 Replies)
Discussion started by: vikas027
2 Replies

2. Shell Programming and Scripting

perl (word by word check if a hash key)

Hi, Now i work in a code that 1-get data stored in the database in the form of hash table with a key field which is the " Name" 2-in the same time i open a txt file and loop through it word by word 3- which i have a problem in is that : I need to loop word by word and check if it is a... (0 Replies)
Discussion started by: eng_shimaa
0 Replies

3. UNIX for Dummies Questions & Answers

Script to search for a particular word in files and print the word and path name

Hi, i am new to unix shell scripting and i need a script which would search for a particular word in all the files present in a directory. The output should have the word and file path name. For example: "word" "path name". Thanks for the reply in adv,:) (3 Replies)
Discussion started by: virtual_45
3 Replies

4. Shell Programming and Scripting

extract whole thing in word, leaving behind last word. - perl

Hi, i've a string /u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD/TESi T_11_HD_120/hd-12 i need to get string, like /u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD the words from HD should get deleted, i need only a string till HD, i dont want to use any built in... (4 Replies)
Discussion started by: asak
4 Replies

5. Shell Programming and Scripting

Find and replace a word in all the files (that contain the word) under a directory

Hi Everyone, I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap". For Example: In the Directory, $pwd /home/nick $ grep -l "xsgd1234dap" *.sh | wc -l 119 I have "119" files that are still using... (5 Replies)
Discussion started by: filter
5 Replies

6. Shell Programming and Scripting

find a word and print n lines before and after the match

how to find a word and print n lines before and after the match until a blank line is encounterd (14 Replies)
Discussion started by: chidori
14 Replies

7. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

8. Shell Programming and Scripting

[Solved] Search for a word and print the next word

Hi, I am trying to search for a word and print the next word. For example: My text is "<TRANSFORMATION TYPE ="Lookup Procedure">" I am searching for "TYPE" and trying to print ="Lookup Procedure" I have written a code like following: echo $line | nawk... (4 Replies)
Discussion started by: sampoorna
4 Replies

9. Shell Programming and Scripting

Search for a specific word and print only the word from the input file

Hi, I have a sample file as shown below, I am looking for sed or any command which prints the complete word only from the input file. Ex: $ cat "sample.log" I am searching for a word which is present in this file We can do a pattern search using grep but I need to cut only the word which... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies

10. Shell Programming and Scripting

Find a word and increment the number in the word & save into new files

Hi All, I am looking for a perl/awk/sed command to auto-increment the numbers line in file, P1.tcl: run_build_model sparc_ifu_dec run_drc set_faults -model path_delay -atpg_effectiveness -fault_coverage add_delay_paths P1 set_atpg -abort_limit 1000 run_atpg -ndetects 1000 I would like... (6 Replies)
Discussion started by: jypark22
6 Replies
HTML::Entities::Numbered(3pm)				User Contributed Perl Documentation			     HTML::Entities::Numbered(3pm)

NAME
HTML::Entities::Numbered - Conversion of numbered HTML entities SYNOPSIS
use HTML::Entities::Numbered; $html = 'Hi Honey<b>&hearts;</b>'; # convert named HTML entities to numbered (decimal) $decimal = name2decimal($html); # Hi Honey<b>&#9829;</b> # to numbered (hexadecimal) $hex = name2hex($html); # Hi Honey<b>&#x2665;</b> $content = 'Copyright &#169; Larry Wall'; # convert numbered HTML entities (decimal) to named $name1 = decimal2name($content); # Copyright &copy; Larry Wall $content = 'Copyright &#xA9; Larry Wall'; # convert numbered HTML entitites (hexadecimal) to named $name2 = hex2name($content); # Copyright &copy; Larry Wall $xml = '&quot;Give me &yen;10,000&quot; &gt; cherie&spades;'; # convert named HTML entities to numbered # except valid XML entities (decimal) $decimal = name2decimal_xml($xml); # &quot;Give me &#165;10,000&quot; # &gt; cherie&#9824; # to numbered except valid XML entities (hexdecimal) $hex = name2hex_xml($xml); # &quot;Give me &#xA5;10,000&quot; # &gt; cherie&#x2660; DESCRIPTION
HTML::Entities::Numbered is a content conversion filter for named HTML entities (symbols, mathmetical symbols, Greek letters, Latin let- ters, etc.). When an argument of "name2decimal()" or "name2hex()" contains some nameable HTML entities, they will be replaced to numbered HTML entities. And when an argument of "name2decimal_xml()" or "name2hex_xml()" contains some nameable numbered HTML entities, they will be replaced to numbered HTML entities except valid XML entities (the excepted "valid XML entities" are the following five entities: "&lt;", "&gt;", "&amp;", "&quot;", "&apos;"). By the same token, when an argument of "decimal2name()" or "hex2name()" contains some nameable num- bered HTML entities, they will be replaced to named HTML entities. (the exception "valid XML entities" means the following five entities: "&lt;", "&gt;", "&amp;", "&quot;", "&apos;") On version 0.03, the entities hash table is imported from HTML::Entities (with obsolete class "HTML::Entities::Numbered::Extra" for older releases of Perl). At the moment, 0.04 (or later) is included HTML::Entities::Numbered::Table to import HTML entities table, and thereby we do not need to have HTML::Entities (included in HTML::Parser distribution). This may be also useful for making valid XML (corrects the undefined entity references, and enhanced by addition of functions conform to the XML). FUNCTIONS
Following all functions are exported by default. * name2decimal Some included named HTML entities in argument of "name2decimal()" will be replaced to decimal numbered HTML entities. * name2hex Some included named HTML entities in argument of "name2hex()" will be replaced to hexadecimal numbered HTML entities. * decimal2name Some include decimal numbered HTML entities in argument of "decimal2name()" will be replaced to named HTML entities (If they're name- able). * hex2name Some include hexadecimal numbered HTML entities in argument of "hex2name()" will be replaced to named HTML entities (If they're name- able). * name2decimal_xml Some included named HTML entities in argument of "name2decimal_xml()" will be replaced to decimal numbered HTML entities except valid XML entities. * name2hex_xml Some included named HTML entities in argument of "name2hex_xml()" will be replaced to hexadecimal numbered HTML entities except valid XML entities. If you'd prefer not to import them functions into the caller's namespace, you can call them as below: use HTML::Entities::Numbered (); $decimal = HTML::Entities::Numbered::name2decimal($str); $hex = HTML::Entities::Numbered::name2hex($str); $named1 = HTML::Entities::Numbered::decimal2name($str); $named2 = HTML::Entities::Numbered::hex2name($str); $decimal = HTML::Entities::Numbered::name2decimal_xml($str); $hex = HTML::Entities::Numbered::name2hex_xml($str); AUTHOR
Koichi Taniguchi <taniguchi@livedoor.jp> Develop triggered by IKEBE Tomohiro <ikebe@cpan.org> Many thanks to Tatsuhiko Miyagawa <miyagawa@cpan.org> COPYRIGHT
Copyright (c) 2004 Koichi Taniguchi. Japan. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
HTML::Entities, <http://www.w3.org/TR/REC-html40/sgml/entities.html> perl v5.8.8 2008-03-06 HTML::Entities::Numbered(3pm)
All times are GMT -4. The time now is 07:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy