Re: Python dos2unix one liner

2017-11-18 Thread Chris Angelico
On Sat, Nov 18, 2017 at 9:42 PM, wrote: > Hello, > > I need to perform a tp on semaphores and shared segments of memory, but I > have a bit of trouble with the first notion. A tp? Sorry, not something I'm familiar with. > We are asked here to use only the IPC system 5

Re: Python dos2unix one liner

2017-11-18 Thread gabsiwided12
Hello, I need to perform a tp on semaphores and shared segments of memory, but I have a bit of trouble with the first notion. In short, we are asked to create 3 programs: The first director, who with the create capacity file argument, will create the museum with the different IPC system

Re: Python dos2unix one liner

2010-03-12 Thread Albert van der Horst
In article hmdlc0$oc...@news.eternal-september.org, Martin P. Hellwig martin.hell...@dcuktec.org wrote: On 02/28/10 11:05, Stefan Behnel wrote: Steven D'Aprano, 28.02.2010 09:48: There ought to be some kind of competition for the least efficient solution to programming problems That wouldn't

Re: Python dos2unix one liner

2010-02-28 Thread Steven D'Aprano
On Sat, 27 Feb 2010 19:37:50 -0800, staticd wrote: Amusing how long those Python toes can be. In several replies I have noticed (often clueless) opinions on Perl. When do people learn that a language is just a tool to do a job? When do people learn that language makes a difference?  I used

Re: Python dos2unix one liner

2010-02-28 Thread Stefan Behnel
Steven D'Aprano, 28.02.2010 09:48: There ought to be some kind of competition for the least efficient solution to programming problems That wouldn't be very interesting. You could just write a code generator that spits out tons of garbage code including a line that solves the problem, and then

Re: Python dos2unix one liner

2010-02-28 Thread Martin P. Hellwig
On 02/28/10 11:05, Stefan Behnel wrote: Steven D'Aprano, 28.02.2010 09:48: There ought to be some kind of competition for the least efficient solution to programming problems That wouldn't be very interesting. You could just write a code generator that spits out tons of garbage code including

Re: Python dos2unix one liner

2010-02-28 Thread John Bokma
Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Sat, 27 Feb 2010 11:27:04 -0600, John Bokma wrote: When do people learn that a language is just a tool to do a job? When do people learn that there are different sorts of tools? A professional wouldn't use a screwdriver when

Re: Python dos2unix one liner

2010-02-28 Thread Steven D'Aprano
On Sun, 28 Feb 2010 12:05:12 +0100, Stefan Behnel wrote: Steven D'Aprano, 28.02.2010 09:48: There ought to be some kind of competition for the least efficient solution to programming problems That wouldn't be very interesting. You could just write a code generator that spits out tons of

Python dos2unix one liner

2010-02-27 Thread @ Rocteur CC
learning Python, I have to think in Python, as I'm a Python newbie I fired up Google and typed: +python convert dos to unix +one +liner Found perl, sed, awk but no python on the first page So I tried +python dos2unix +one +liner -perl Same thing.. But then I found http://wiki.python.org/moin

Re: Python dos2unix one liner

2010-02-27 Thread Martin P. Hellwig
On 02/27/10 09:36, @ Rocteur CC wrote: cut dos2unix oneliners;python vs perl/sed/awk Hi a couple of fragmented things popped in my head reading your question, non of them is very constructive though in what you actually want, but here it goes anyway. - Oneline through away script with re as a

Re: Python dos2unix one liner

2010-02-27 Thread Peter Otten
@ Rocteur CC wrote: But then I found http://wiki.python.org/moin/Powerful%20Python%20One-Liners and tried this: cat file.dos | python -c import sys,re; [sys.stdout.write(re.compile('\r\n').sub('\n', line)) for line in sys.stdin] file.unix And it works.. - Don't build list

Re: Python dos2unix one liner

2010-02-27 Thread Steven D'Aprano
On Sat, 27 Feb 2010 10:36:41 +0100, @ Rocteur CC wrote: cat file.dos | python -c import sys,re; [sys.stdout.write(re.compile('\r\n').sub('\n', line)) for line in sys.stdin] file.unix Holy cow!!! Calling a regex just for a straight literal-to-literal string replacement! You've been

Re: Python dos2unix one liner

2010-02-27 Thread @ Rocteur CC
On 27 Feb 2010, at 12:44, Steven D'Aprano wrote: On Sat, 27 Feb 2010 10:36:41 +0100, @ Rocteur CC wrote: cat file.dos | python -c import sys,re; [sys.stdout.write(re.compile('\r\n').sub('\n', line)) for line in sys.stdin] file.unix Holy cow!!! Calling a regex just for a straight

Re: Python dos2unix one liner

2010-02-27 Thread sstein...@gmail.com
On Feb 27, 2010, at 10:01 AM, @ Rocteur CC wrote: Nothing to do with Perl, Perl only takes a handful of characters to do this and certainly does not require the creation an intermediate file Perl may be better for you for throw-away code. Use Python for the code you want to keep (and read

Re: Python dos2unix one liner

2010-02-27 Thread Stefan Behnel
@ Rocteur CC, 27.02.2010 10:36: cat file.dos | python -c import sys,re;[sys.stdout.write(re.compile('\r\n').sub('\n', line)) for line in sys.stdin] file.unix See: http://partmaps.org/era/unix/award.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python dos2unix one liner

2010-02-27 Thread Grant Edwards
On 2010-02-27, @ Rocteur CC mac...@rocteur.cc wrote: Nothing to do with Perl, Perl only takes a handful of characters to do this and certainly does not require the creation an intermediate file, Are you sure about that? Or does it just hide the intermediate file from you the way that sed -i

Re: Python dos2unix one liner

2010-02-27 Thread John Bokma
sstein...@gmail.com sstein...@gmail.com writes: On Feb 27, 2010, at 10:01 AM, @ Rocteur CC wrote: Nothing to do with Perl, Perl only takes a handful of characters to do this and certainly does not require the creation an intermediate file Perl may be better for you for throw-away code. Use

Re: Python dos2unix one liner

2010-02-27 Thread Alf P. Steinbach
* @ Rocteur CC: On 27 Feb 2010, at 12:44, Steven D'Aprano wrote: On Sat, 27 Feb 2010 10:36:41 +0100, @ Rocteur CC wrote: cat file.dos | python -c import sys,re; [sys.stdout.write(re.compile('\r\n').sub('\n', line)) for line in sys.stdin] file.unix Holy cow!!! Calling a regex just for

Re: Python dos2unix one liner

2010-02-27 Thread Steven D'Aprano
On Sat, 27 Feb 2010 16:01:53 +0100, @ Rocteur CC wrote: On 27 Feb 2010, at 12:44, Steven D'Aprano wrote: On Sat, 27 Feb 2010 10:36:41 +0100, @ Rocteur CC wrote: cat file.dos | python -c import sys,re; [sys.stdout.write(re.compile('\r\n').sub('\n', line)) for line in sys.stdin] file.unix

Re: Python dos2unix one liner

2010-02-27 Thread sstein...@gmail.com
On Feb 27, 2010, at 12:27 PM, John Bokma wrote: sstein...@gmail.com sstein...@gmail.com writes: On Feb 27, 2010, at 10:01 AM, @ Rocteur CC wrote: Nothing to do with Perl, Perl only takes a handful of characters to do this and certainly does not require the creation an intermediate file

Re: Python dos2unix one liner

2010-02-27 Thread Grant Edwards
On 2010-02-27, @ Rocteur CC mac...@rocteur.cc wrote: On 27 Feb 2010, at 12:44, Steven D'Aprano wrote: On Sat, 27 Feb 2010 10:36:41 +0100, @ Rocteur CC wrote: cat file.dos | python -c import sys,re; [sys.stdout.write(re.compile('\r\n').sub('\n', line)) for line in sys.stdin] file.unix

Re: Python dos2unix one liner

2010-02-27 Thread John Bokma
sstein...@gmail.com sstein...@gmail.com writes: I'm not sure how use it for what it's good for has anything to do with toes. I've the feeling that some people who use Python are easily offended by everthing Perl related. Which is silly; zealotism in general is, for that matter. I've written

Re: Python dos2unix one liner

2010-02-27 Thread ssteinerx
On Feb 27, 2010, at 1:15 PM, John Bokma wrote: I sure don't want to maintain Perl applications though; even ones I've written. Ouch, I am afraid that that tells a lot about your Perl programming skills. Nah, it tells you about my preferences. I can, and have, written maintainable things

Re: Python dos2unix one liner

2010-02-27 Thread Aahz
In article 87mxyuzj13@castleamber.com, John Bokma j...@castleamber.com wrote: Amusing how long those Python toes can be. In several replies I have noticed (often clueless) opinions on Perl. When do people learn that a language is just a tool to do a job? When do people learn that language

Re: Python dos2unix one liner

2010-02-27 Thread Steven D'Aprano
On Sat, 27 Feb 2010 11:27:04 -0600, John Bokma wrote: When do people learn that a language is just a tool to do a job? When do people learn that there are different sorts of tools? A professional wouldn't use a screwdriver when they need a hammer. Perl has strengths: it can be *extremely*

Re: Python dos2unix one liner

2010-02-27 Thread staticd
Amusing how long those Python toes can be. In several replies I have noticed (often clueless) opinions on Perl. When do people learn that a language is just a tool to do a job? When do people learn that language makes a difference?  I used to be a Perl programmer; these days, you'd have to