{"absolute_url": "/voyeg3r/create-image-gallery-html-with-bash-awk-and-sed/", "blog_post": false, "code": "#!/bin/bash\n# Criado em:Dom 17/Abr/2011 hs 11:55\n# Last Change: 2011 Abr 18 13:36:58\n# vim:ft=sh:fdm=syntax:nu:\n# Proposito do script: Criar uma galeria de imagens html\n# Autor: Sérgio Luiz Araújo Silva\n# site: http://vivaotux.blogspot.com\n# twitter: http://www.twitter.com/voyeg3r\n\nread -p \"indique o local das imagens: \" local\necho \"local das imagens $local\"\nsleep 1\nread -p \"indique o tamanho das imagens: \" tamanho\necho \"tamanho das imagens $tamanho\"\nsleep 1\n\n\n\ncd $local\nfor i in `ls *.png`; do\n echo \" \" >> ${OLDPWD}/galeria1.html\ndone\n\ncd $OLDPWD\n# a cada tres linhas uma quebra de coluna\ncat galeria1.html | awk '{print $0; if (NR%3==0) print \"\\n\"}' >> galeria.html\n\nsed -i '1i\\n\\n\\n' galeria.html\nsed -i '$a
\\n\\n' galeria.html\n\nrm -f galeria1.html\n\n", "created": "2011-04-17T11:27:47", "description": null, "description_rendered": "None", "embed_url": "https://snipt.net/embed/6773e5284213eae94d3060375bbcb0d2/", "full_absolute_url": "/voyeg3r/create-image-gallery-html-with-bash-awk-and-sed/", "id": 25601, "lexer": "bash", "line_count": 33, "log_entries": [], "meta": null, "modified": "2019-06-24T06:54:37.007108", "publish_date": null, "raw_url": "/raw/6773e5284213eae94d3060375bbcb0d2/", "resource_uri": "/api/public/snipt/25601/", "slug": "create-image-gallery-html-with-bash-awk-and-sed", "stylized": "
 1\n 2\n 3\n 4\n 5\n 6\n 7\n 8\n 9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31
#!/bin/bash\n# Criado em:Dom 17/Abr/2011 hs 11:55\n# Last Change: 2011 Abr 18 13:36:58\n# vim:ft=sh:fdm=syntax:nu:\n# Proposito do script: Criar uma galeria de imagens html\n# Autor: Sérgio Luiz Araújo Silva\n# site: http://vivaotux.blogspot.com\n# twitter: http://www.twitter.com/voyeg3r\n\nread -p "indique o local das imagens: " local\necho "local das imagens $local"\nsleep 1\nread -p "indique o tamanho das imagens: " tamanho\necho "tamanho das imagens $tamanho"\nsleep 1\n\n\n\ncd $local\nfor i in `ls *.png`; do\n   echo "<td> <img src=${local}/$i width=$tamanho heith=${tamanho}> </td>"  >> ${OLDPWD}/galeria1.html\ndone\n\ncd $OLDPWD\n# a cada tres linhas uma quebra de coluna\ncat galeria1.html |  awk '{print $0; if (NR%3==0) print "</tr>\\n<tr>"}' >> galeria.html\n\nsed -i '1i<html>\\n<body>\\n<table>\\n<tr>' galeria.html\nsed -i '$a</table>\\n</body>\\n</html>' galeria.html\n\nrm -f galeria1.html\n
\n
", "tags": [{"absolute_url": "/public/tag/bash/", "id": 21, "name": "bash", "resource_uri": "/api/public/tag/21/", "snipts": "/api/public/snipt/?tag=21"}, {"absolute_url": "/public/tag/sed/", "id": 168, "name": "sed", "resource_uri": "/api/public/tag/168/", "snipts": "/api/public/snipt/?tag=168"}, {"absolute_url": "/public/tag/awk/", "id": 456, "name": "awk", "resource_uri": "/api/public/tag/456/", "snipts": "/api/public/snipt/?tag=456"}], "title": "Create image gallery (html) with bash, awk and sed", "user": {"absolute_url": "/voyeg3r/", "email_md5": "a5f3d249cc5053cdc1eb4ede60fd2f45", "id": 2390, "resource_uri": "/api/public/user/2390/", "snipts": "/api/public/snipt/?user=2390", "snipts_count": 107, "username": "voyeg3r"}}