DW's Home Page : Blog
September 16, 2003
VI Tip
In vi, you may search for control characters by typing /^[xxx]
where ^ means [ctrl-v] and xxx is an ascii code. Useful for matching line-endings (a nice shortcut is /^[enter]
). Mac files look like one long line in vi, but if you have vim just add a set fileformats=unix,mac,dos
to your .vimrc and vim will behave nicely.
To batch convert line endings in the shell:
tr "\r" "\n" < mac.txt > unix.txt
Or to get grep to actually work in Mac files:
tr "\r" "\n" < mac.txt | grep 'text'
.
Posted by dirkpitt2050 on September 16, 2003 12:05 PM
Post a comment