[CentOS] Vim scripting - cursor motion

m.roth at 5-cent.us m.roth at 5-cent.us
Thu Jun 9 15:19:24 UTC 2011


Jussi Hirvi wrote:
> On 9.6.2011 18.01, m.roth at 5-cent.us wrote:
>> Why do vim scripting? That's what sed, or awk, or perl, are for. The
>> latter two, of course, are much easier to comprehend the logic, too.
>
> Maybe just because I know vim better than sed, awk or perl, which I
> haven't used at all. :-)
>
> The practical purpose is to turn a tabtext file into CSV
> (comma-separated) to be used in a SQL insert statement.

Oh. I'm not that good on sed, but awk would be:
awk '{gsub(/\t/, ",", $0);print $0;}' tabtextfile.

            mark




More information about the CentOS mailing list