cat /tmp/tabfile | sed 's/ / /' > /tmp/notabfile;
Sorry, but just replacing every TAB character with a fixed number (in this case, four) of SPACE
characters is incorrect. To properly expand TAB characters, each TAB needs to be replaced with a
variable number of SPACE characters, depending on which column the TAB is in.
For instance if you have a line:
foo bar
(i.e. "foo", a TAB, and "bar"), the TAB should be replaced with just one SPACE. (Assuming the
intended tab width is four columns, as it is in OOo/LO. Note that traditionally the tab width is
eight columns.)
(Also, you would want to use the "g" modifier in the sed 's' command to replace every TAB on each
line, not just the first.)
Anyway, the "expand" command is the right tool to expand tabs.
P.S. Your script can be written much simpler, no need to use "cat" so much:
while read fn </tmp/tabs.auto.filelist.txt; do
sed 's/ / /g' < $fn > /tmp/notabfile
mv /tmp/notabfile $fn
done
(Here still incorrectly using "sed" and not "expand".)
--tml
Context
- Re: [Libreoffice] Test script patch review request (1) · Tor Lillqvist
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.