Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: newlines for windows from unix

by Tiefling (Monk)
on Jun 07, 2001 at 17:52 UTC ( [id://86553]=note: print w/replies, xml ) Need Help??


in reply to newlines for windows from unix

On a related note - how can I strip out Windows newlines from the WordPad-compiled files I now1 intend using in Linux?

Thanks!

Tiefling

1: In other words, they already exist. If I were writing them now, I'd write them in a Linux text editor.

Replies are listed 'Best First'.
Re:{2} newlines for windows from unix
by jeroenes (Priest) on Jun 07, 2001 at 18:25 UTC
    I have a script, chmod +x, in ~/bin:
    #!/usr/bin/perl -i -p tr/\015//d;
    and I run it like: removecarr.pl ugly_whoze_file Jeroen
    "We are not alone"(FZ)
Re: Re: newlines for windows from unix
by murphya (Sexton) on Jun 07, 2001 at 18:16 UTC
    May I suggest that you use a proper text editor in windows. That way your text files are not stored with the windows new line rubbish on the end.

    I use conText which I downloaded for free from the internet and which I can highly recommend (nothing can be too bad if it is free, but this is truely good ;)).

    As to your question. I have a script loops through each line of files doing a sub for 012 and 015, replacing them with nothing. In that way you remove any newlines present. Then add an 'if' keying on $^0 eg if($^0 eq 'wnt'){..... to check the OS and add the suitable newline.

    This is clunky but simple to write and quaranteed to work.

    Hope that this helps.

    "The significant problems we face in life can not be solved at the same level of thinking we were at when we created them." -Albert Einstein

Re: Re: newlines for windows from unix
by ZZamboni (Curate) on Jun 07, 2001 at 19:20 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-29 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found