Gossamer Forum
Home : General : Perl Programming :

Bare Linefeeds

Quote Reply
Bare Linefeeds
Is there an easy way to get rid of the black squares that I suppose are the bare line feeds. I fixed most files by highlighting them and entering but there is a large file that wont open in notebook but in wordpad it looks right but when i upload it has like 1500 bare linefeeds.

Thank if you can help.
Quote Reply
Re: Bare Linefeeds In reply to
How about uploading in ascii mode?

Smile

--mark

------------------
Due to repeated requests for support via ICQ, I am once again offering support online.

The ONLY number I will accept requests on is #53788453. Messages sent to my other numbers will not pass through to me, as I have security settings set to ignore messages from users not on that list.

I don't know how often I will be active on this number, as it is for only when I am free to offer assistance.

Could this signature be any longer? :)
Quote Reply
Re: Bare Linefeeds In reply to
I know uploading in ascii, that wasn't quite the question. It was if you have a file that already is like that and when you upload ,in ascii, it says warning bare line feeds. I was wondering if there was an easy way to fix it.
Quote Reply
Re: Bare Linefeeds In reply to
when you upload in ascii.. that isn't a problem..

jerry
Quote Reply
Re: Bare Linefeeds In reply to
Code:
open(NFILE, "your_file") | | die "$!\n";
@stuff = <NFILE>;
close(NFILE);
open(NFILE, ">your_file") &#0124; &#0124; die "$!\n";
foreach (@stuff) {
s/[\m\r\f]//g;
print NFILE;
}
close(NFILE);
If that doesn't work, run through an ascii output until you find the character that is causing that block and use the chr() func to assign the character to a var and put it in the regex.
-- Gordon --


------------------
$blah='82:84:70:77';
print chr($_) foreach (split/:/,$blah);

Quote Reply
Re: Bare Linefeeds In reply to
If your trying to strip out winblows careermag returns [R] in a UNIX text you can use the tr command, cat <filename> | tr -d "\r" > <filename>


------------------
Ryan Brown
fpsn.net, Inc.
rbrown@fpsn.net
Quote Reply
Re: Bare Linefeeds In reply to
Or using perl:

perl -i.bak -e "while (<> ) { s/\r//g; print; }" myfile.txt

The -i.bak tells perl to use interactive mode which accepts one or more filenames as input and then runs the code snippet on that file with STDIN as the file's input and STDOUT as the file's output.

Cheers,

Alex