l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2011 Jun 23 13:20

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Problems with missing 'missing' file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Problems with missing 'missing' file

Quoting Shwaine (shwaine@shwaine.com):

> Assuming that the \r is actually carriage return (and not a literal string 
> consisting of backslash and the letter r) and that this was originally an 
> older Mac formated file, you probably don't want to remove \r.

I actually meant exactly what I typed, i.e., the backslash as an escape,
followed by a character 'r'.  That's the way you refer to an ASCII 13
carriage return control character in vim search strings.  Line feed
would be \n.  Attempt to insert an actual CR into a vim ex-mode search
string, and you won't get the result you had in mind.

Whether that's specifically what the original poster needed, dunno.  I
really don't remember _precisely_ what he said at this point, and don't
want to spend time looking it up.  I recall him saying that he had some
files with spurious embedded CRs and needed to remove him so related
software can build, hence wanted to use a canned utility for the
purpose.  My point was that, regardless of whether you think you want to
strip spurious CRs or spurious LFs or other such junk from a
modest-sized text file, ex-mode search & replace in vim is often the
most pragmatic method, because, even if you screw up the search, you can
trivially undo your change and try again differently.

> Older Mac files only have a carriage return to mark the end of line
> and do not have a line feed (\n, the end-of-line delimiter on
> Unix/Linux). So if you remove the carriage returns on an old Mac file,
> you end up with one very long line.

As I said upthread, and I said again above, the good thing about
attempting such a repair operation in vim is that, if you guess wrong
about what to do, or implement it badly, you can mumble 'Oops!', hit u
for undo, and you're right back and can get it right on Round Two.

> Better to check if there are line feeds....

No, better to just try out what you think is needed, and if you fumbled
it, undo, try again two seconds later.  Faster, gets the problem out of
the way.  Not worth the time to even remember all the antediluvian crap
about 'Old Mac files terminate ASCII lines with CR only, other Unixes
terminates ASCII lines with LF, DOS/Windows terminates ASCII lines with
CR LF.'  I'd reclaim those neurons for something actually useful if I

The only slow bit is arguing with obsessives on mailing lists.  ;->

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.