Add the whole blog
This commit is contained in:
parent
0d2f58ce7a
commit
c4f23c1529
418 changed files with 15708 additions and 0 deletions
48
content/post/2007-05-24-tab2dokuwiki.markdown
Normal file
48
content/post/2007-05-24-tab2dokuwiki.markdown
Normal file
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
author: einar
|
||||
categories:
|
||||
- General
|
||||
- Linux
|
||||
comments: true
|
||||
date: "2007-05-24T18:16:18Z"
|
||||
slug: tab2dokuwiki
|
||||
title: tab2dokuwiki
|
||||
disable_share: true
|
||||
wordpress_id: 251
|
||||
---
|
||||
|
||||
Today I made a simple sed script that converts a tab-delimited text file to a format that can be pasted into a [DokuWiki](http://wiki.splitbrain.org/wiki:dokuwiki) wiki. [There is a plugin](http://wiki.splitbrain.org/plugin:csv) that permits to read CSV files directly, however:
|
||||
|
||||
|
||||
|
||||
|
||||
* It doesn't support tab-delimited text files;
|
||||
|
||||
|
||||
* It's incompatible with some plugins (one being [DokuTexit](http://danjer.doudouke.org/tech/dokutexit), which I need).
|
||||
|
||||
|
||||
Hence the need for this script. To use it, just copy and paste the code (see below) into a new file, make it executable (chmod +x) and then invoke it with
|
||||
|
||||
[code lang="bash"]
|
||||
tab2wiki inputfile
|
||||
[/code]
|
||||
|
||||
Note that it outputs the result on stdout, so you'll need to redirect it if you want to save.
|
||||
|
||||
Without further ado, here's the script (syntax may be off regarding colors):
|
||||
|
||||
[code lang='c']
|
||||
#!/bin/sed -f
|
||||
# tab2wiki - converts any tab-delimited file into a DokuWiki table
|
||||
# First line is treated as header (^)
|
||||
{
|
||||
s/\t/| /g
|
||||
s/$/ |/g
|
||||
s/^/| /g
|
||||
s/| / | /g
|
||||
1s/|/\^/g
|
||||
s/^\s\s//g
|
||||
}
|
||||
[/code]
|
||||
*[CSV]: Comma Separated Values
|
Loading…
Add table
Add a link
Reference in a new issue