Last active
November 9, 2016 05:47
-
-
Save ldante86/4a4c5c565f07f0197cda81cddccdeb7b to your computer and use it in GitHub Desktop.
html version of btags.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash - | |
if [ ! "$1" ]; then | |
exit 1 | |
fi | |
in_file="$1" | |
if [ ! -e "$in_file" ] || [ -d "$in_file" ]; then | |
exit 1 | |
fi | |
egrep -on '[A-Za-z0-9_]+[(]+[)]' "$in_file" >/dev/null || exit 1 | |
lineno=() | |
fname=() | |
echo "<table style=\"width:50%\" border=\"1\">" | |
echo "<tr>" | |
echo "<th>Functions for $in_file</th>" | |
echo "<th>Line Number</td>" | |
echo "</tr>" | |
for i in $(egrep -on '[A-Za-z0-9_]+[(]+[)]' "$in_file" | awk -F ":" '{print $1}') | |
do | |
lineno+=( "$i" ) | |
done | |
for i in $(egrep -on '[A-Za-z0-9_]+[(]+[)]' "$in_file" | awk -F ":" '{print $2}') | |
do | |
fname+=( "$i" ) | |
done | |
n=0 | |
for i in `echo "${fname[@]}" | tr -d '()'` | |
do | |
echo "<tr>" | |
echo "<td>$i</td>" | |
echo "<td>${lineno[n++]}</td>" | |
echo "</tr>" | |
done | |
echo "</table>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment