Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Replacing charecters in files

by esh (Pilgrim)
on Sep 03, 2003 at 05:04 UTC ( [id://288513]=note: print w/replies, xml ) Need Help??


in reply to Replacing charecters in files

I don't think you've provided quite enough information to get a complete answer. Two aspects of your question seem vague to me:

  1. You provide some samples of "special characters" but end it with "etc..." Knowing exactly what you consider to be "acceptable characters" and what you consider to be "special characters" may change the answer a bit.

  2. You say you want to "strip special characters" without "damaging the file information". I would need to know what the resulting output is going to be used for in order to determine if the information is damaged in the stripping process.

On the second point, it may help to provide both a description of what the information is going to be used for and some examples of what your input and desired output should be.

If deleting the special characters damages the information, you may want to encode them or escape them, but the way to do this is highly context dependent.

Without additional information, all I can offer is to add one line to your sample code:

open(INFILE, "$command |"); print "$command -report\n"; while (<INFILE>) { $files = @f[15]; # Delete special characters like ; ' $ ^ $files =~ tr/;'$^//d print OUTFILE "$SQL_insert ('$files');\n"; ... }

-- Eric Hammond

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://288513]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-19 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found