[CentOS] Vim scripting - cursor motion
John Doe
jdmls at yahoo.com
Fri Jun 10 09:55:38 UTC 2011
From: Jussi Hirvi <listmember at greenspot.fi>
> :% s/\t/","/g
> Then I should add something to the beginning of file (line 1, char 1).
> And append something to the end of the file (last line, last char). But
> I cannot find a way to do this. Should I move the cursor (and how?), or
> what?
echo "First Line" > NEWFILE
cat FILE | tr '\t' ',' >> NEWFILE or sed 's/\t/,/g' FILE >> NEWFILE
echo "Last Line" >> NEWFILE
or
awk ' BEGIN { print "First Line"; } { gsub(/\t/, ",", $0);print $0; } END { print "Last Line"; } ' FILE > NEWFILE
JD
More information about the CentOS
mailing list