Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^6: Search and delete lines based on string matching

by brut (Initiate)
on Mar 13, 2007 at 15:07 UTC ( #604564=note: print w/replies, xml ) Need Help??

in reply to Re^5: Search and delete lines based on string matching
in thread Search and delete lines based on string matching

Ok so this next code is not working in the sense it's not giving an error but its not producing the result.

I will put my files as such I am using

File A:

A[0] B C
File B:
A[0] C
File C should be:
Also as in previous reply if instead of deleting you have to add contents of file A to end of file B with inserting some string before every string like "This string added from file A" and then the dtring from file A.

Kindly reply

Replies are listed 'Best First'.
Re^7: Search and delete lines based on string matching
by imp (Priest) on Mar 13, 2007 at 15:17 UTC
    For deletion you would use this pattern, sorry:
    while (my $line = <$pattern_fh>) { chomp $line; # Use quotemeta to allow for items like A[0] push @tokens, quotemeta($line); } my $pattern = '^(?:' . join('|', @tokens) . ')[^a-zA-Z]*$'; print "Search pattern: $pattern\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://604564]
[Corion]: erix: There is somebody who has hacked up some Ruby scripts to do just that, but the Ruby scripts have some hardcoded #defines (well, reimplement those), so the extraction doesn't compile for Windows...
[Corion]: libpg_query
[Corion]: ... and I think "porting" it basically means (re)implementing a C preprocessor and feeding that one with the appropriate #defines for the platforms, and/or providing stub implementations for OS-specific functions that the query parser really wants to call
[erix]: ah, interesting. Well, sounds like a good start..
[Corion]: In the long run, obviously, the parser wouldn't need/call OS-specific stuff anyway, but we're a long way from that :D
[Corion]: erix: Yeah - I think basically the solution should be a "fake_os.h", which implements just enough stub routines for any OS to make the compilation of the parser pass. But for that, the complete (relevant) source code needs to be extracted, and the ...
[Corion]: ... Ruby script only extracts parts of the source code as Windows-specific files aren't considered relevant

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2018-07-23 11:36 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (464 votes). Check out past polls.