Guest User

Untitled

a guest
Feb 19th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.39 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. textfile="file.txt"
  4. htmlfile="file.html"
  5.  
  6. rm "$htmlfile"
  7. x=0
  8.  
  9. cat "$textfile" |sed 's/=/\n=\n/g'|while read line
  10. do
  11.     if [ "$line" = "=" ]
  12.     then
  13.       if [ "$x" = "0" ]
  14.       then
  15.         echo "<h1>" >> "$htmlfile"
  16.         x=1
  17.       else
  18.         echo "</h1>" >> "$htmlfile"
  19.         x=0
  20.       fi
  21.     else
  22.       echo "$line" >> "$htmlfile"
  23.     fi
  24. done
Add Comment
Please, Sign In to add comment