Incoming from Curtis Sloan: > I have a single text file (a .vcs from Outlook2vCal) that requires some > modifications before importing into korganizer (apparently a bug in > korganizer, but I couldn't find a solution in the archives upon first swath > and I'm kind of anxious to be rid of Outlook ;-). > > Specifically, the DESCRIPTION section in every VEVENT needs to be edited such > that: > > -every comma is escaped (strange, other nasty characters like ':' already are) > -each additional line after the first must start with a space (otherwise it is > ignored, don't ask me why) > -newline/carriage return is honored (currently not -- additional lines are > strung together... but is the newline/carriage return character actually > there? I don't know -- how to check?) > > I am a total n00b when it comes to sed or awk, but if they're appropriate I > have no problems ramping up in a hurry.
*First, make a copy of this file and work on that.* Both vi and emacs have powerful search and replace commands. In vi, you do: :%s/this/that/g emacs has: ESC-x replace-regexp ESC-x query-replace-regexp All of those work well for simple content mangling. However, that bit about "each additional line after the first must start with a space" is non-trivial. Given a better description of the problem, it's likely easy to fix. vi should show you right away if the newlines are Unix newlines. If not, you'll see ^M at the end of each line. You can use tr to remove the ^M chars if they're there: tr -d '^M' < infile > outfile When typing in that command, type "CTRL-v CTRL-m" to get a real ^M in there. So, in vi: :%s/\,/\\,/g Should escape the commas (coincidentally (not), that's what you'd be doing in sed too). You might want to fiddle with it and verify it's doing what you want. ":q!" in vi quits without writing. od can display the file in any manner you'd want to see. Try "od -c infile | less". That'll show the ^M chars if they're there. -- Any technology distinguishable from magic is insufficiently advanced. (*) http://www.spots.ab.ca/~keeling - - _______________________________________________ clug-talk mailing list [EMAIL PROTECTED] http://clug.ca/mailman/listinfo/clug-talk_clug.ca

