TiddlyWiki Tricks

Geek, Lighting Tech, Maker

TiddlyWiki Tricks

Tiddly Tricks

in bash, to count the number of pipes in each line try:

cat test_table.tdl |while read line; do echo $line |sed 's/[^|]//g' |wc -c; done

where test_table.tdl is the file.

use this as a here doc dropped into less:

while read line; do echo $line |sed 's/[^|]//g' |wc -c; done << end | less -NS


while read line; do echo $line |sed 's/[^|]//g' |wc -c; done << end | less -NS

Comments: 3

  1. applemcg says:

    i _love_ functions. try this one:

    count_pipes () { sed 's/[^{]//g' $* | wc -c; }

    so, this works:

    $ count_pipes test_table.tdl

    good idea. thanks for it.

  2. Chris Yarger says:

    I will do! Keep an eye out I am currently working on version 1.02 which will have a whole slew of various features. Also within a few revisions I may add a GUI interface.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.