|
I have a large file that has strings that I would like to extract into a new file, I know I have to use regex but I'm unsure as to How I should format it. I want to save all words that have WS-xxxxx where xxxx is a name everything else in the file I don't care about. Any Ideas?
|
# ¿ Oct 30, 2007 19:57 |
|
|
# ¿ Apr 30, 2024 02:02 |
|
Triple Tech posted:Well, what you're saving in the ideal Perl world would probably become an array. How that is serialized is completely up to you and shouldn't matter. You could freeze/thaw the entire structure (overkill). The simplest way to go about it would be to have each item be a line in a text file. This is what I have so far, it cut down a lot of the txt that I didn't need. now each line has this format code:
|
# ¿ Oct 30, 2007 20:28 |
|
hey everyone. I have a template file that I want to copy, however the new file name will be supplied by the user. How can I get File::Copy to work with me? here is my code code:
|
# ¿ Dec 20, 2007 18:23 |
|
Triple Tech posted:I don't understand, is something not working for you? Do you not know how to capture user input? Is it not running?! oh I wasnt sure that it would take a file name as input for the copy command! sorry!
|
# ¿ Dec 20, 2007 18:57 |
|
One more question. I'm writing a perl script to edit the named.conf file, however i need to edit 2 places in the file once in the middle of the file and again at the end (not exactly the end but near the end. How can I tell perl where exactly I want to edit based on this file? here is hopefully a better explanation: code:
|
# ¿ Dec 20, 2007 22:16 |
|
Triple Tech posted:All things in software are possible... the file follows this convention: code:
|
# ¿ Dec 20, 2007 22:35 |
|
Triple Tech posted:Right, so you load up the original conf file and you loop through all of the lines. You analyze a line and decide what to do with it. If do nothing, then just tack it back on to a buffer (another scalar). You're essentially reconstructing the file. so something like this? code:
|
# ¿ Dec 20, 2007 23:04 |
|
wntd posted:The Perl way is to have someone else do the heavy lifting for you. I've only just started using perl, I know thats from CPAN and I know how to install things from CPAN, but I have no idea how this works.
|
# ¿ Dec 21, 2007 15:44 |
|
|
# ¿ Apr 30, 2024 02:02 |
|
I figured it out What I did was add a comment to the conf file I was trying to add data to, then I did a find/replace on that comment. The replacement would also re-add the comment below the new information making it ready for the next entry.
|
# ¿ Dec 21, 2007 23:27 |