#!/usr/bin/perl -w
# $file is the file you want to strip the '"' from.
$file = /path/to/filename;
# $tmp is the file we write w/o the '"'s
$tmp = /path/to/tmp;
# If you want to get $file and $tmp from the command line, remove the
# previous two lines ($file... and $tmp...), and uncomment the next two
# lines:
# $file = $ARGV[0];
# $tmp = $ARGV[1];
# I would also include a check to make sure that the file exists before
# attempting to open it (but that's me), like so:
# if (-e $file) {
# if (-e $tmp) {
# Open $file for reading
open FILE, "<$file" || die "\nDid not open $file\n";
# Open $tmp for writing
open TMP, ">$tmp" || die "\nDid not open $tmp\n";
# For each line of $file...
while (<FILE>) {
# Substitute any and all '"'s with <NULL>.
$line = s/\"//g;
# Write the line to $tmp
pint TMP $line;
} #endwhile
# And ALWAYS close your file handles!
close FILE;
close TMP;
# If you want, you can move $tmp to $file, overwriting the original...To do so,
# Include the following line:
system ("mv $tmp $file");
# } #endif
# } #endif
# END of script
I'm sure that this can be done much more easilly on the command line, but you
wanted perl. You can litterally cut and paste out of this e-mail.
<http://www.perldoc.org> is a great *FREE* site for perl documentation.
Jacob
On Tue, 10 Apr 2001, you wrote:
> Can anyone give me a quick reference for building a script that removes all
> quotes (" symbols) from a given file?
>
> I imagine a sed or perl script could do it. Is there any good free
> books/online resources that teach that kind of stuff? (Besides 'man sed'?)
>
> Thanks,
>
> Dan Browning, Cyclone Computer Systems, [EMAIL PROTECTED]
>
>
>
> _______________________________________________
> Redhat-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-list
--
Jacob Killian
PGTC System Administrator
<mailto: [EMAIL PROTECTED]>
<http://www.pgtc.net>
501-846-7245
"Long may we walk" --my mom
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list