[Wolves] Unix Problem

chris procter chris-procter at talk21.com
Tue May 1 19:55:54 BST 2007

Well if your looking for a simple line ending dos2unix
type replacement script

awk '{print $0 "\r"}' < unix.txt > windows.txt

should (untested!) replace line feed with carriage
return line feed. 

(awk scripts run on each line in the file, $0
indicates the entire line, \r is a carrigae return and
print apends a line feed anyway)

But if its more complex then that, what is the AIX
print spooler using to determine where to put the line
breaks? Is there a character sequence or is it
assuming  fixed length lines or somthing like that?


--- Rob Malpass <rob at malpass133.fsnet.co.uk> wrote:
> Thanks David
> The version of AIX Unix (Korn shell) we use doesn't
> recognise dos2unix.
> I've looked at the man pages for sed and it's quite
> complex.  Also,
> there aren't any characters in the file for
> linefeeds - it just seems to
> be a flat file.  I may try pasting into Ms Word and
> play about with page
> width to try and get some result.
> Thanks anyway
> Rob
> -----Original Message-----
> From: wolves-bounces at mailman.lug.org.uk
> [mailto:wolves-bounces at mailman.lug.org.uk] On Behalf
> Of David Goodwin
> Sent: 01 May 2007 12:15
> To: Wolverhampton Linux User Group
> Subject: Re: [Wolves] Unix Problem
> > I may be missing something obvious, but is there a
> way of manipulating
> > the file in Unix so that I don't have to do this?
> >
> > I'm hoping that those of you have Unix
> experience/background may be
> > able to help.
> How about :
> - dos2unix
> - sed
> I presume you mean the \r\n and \n linefeeds; or is
> something else used?
> David.

> There might be another way - depending on the file -
> and if it's just text,
>  you might be in luck.
> sed (as I remember) is stream editor - a sort of
> find and replace similar
> to tr - that's one approach.
> Another is awk - which is either just as good (or
> just as bad) as sed 
> depending
> on your point of view, but my solution (if it works)
> is much more 
> straightforward.
> If on Window$, open in notepad, copy and paste in
> Word (not sure if OOo is 
> similar)
> and then save the word file as plain text.   I've
> had this annoying problem 
> in the past
> and I'm sure this is how I got round it.   The
> action of pasting raw text in 
> seems to
> insert line wrap characters.   You may need to setup
> a fixed with font like 
> courier
> before doing the pasting.
> If you can invest the time though, writing an awk
> program is probably the 
> best bet
> without having to go via M$
> Cheers
> Rob 

Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 

More information about the Wolves mailing list