1
For hours I’ve been trying to find a way to include the contents of 4 distinct files for a new output file -; "output.html". The 4 files I’m looking to extract information from are:
- link.txt
- photo.txt
- caption.txt
- name.txt
Important! - since the files and their respective contents are on my back, that is, on my machine. And it would not be feasible to post everything here.
I ask anyone who can give that task force, to create the files on your PC: with the command
touch
orecho
Add dummy links to the link.txt file. Example:
- www.seusite.com
- www.seusite.no.ar
- your site.conoscome.me
- www.site-name.here
- http://site.saindo.do.ar
- ftp://mirror.siteseu.org
- https://pediusite.biz
- www.saiusite.com.br
Add names to photos in photo.txt file. Example:
- 1.png
- 2.png
- 3.png
- 4.png
- 5.png
- 6.png
- 7.png
- 8.png
Add any subtitles to the subtitle file.txt. Example:
- Agent 01
- Agent 02
- Agent 03
- Agent 04
- Agent 05
- Agent 06
- Agent 07
- Agent 08
And finally, name it, add it inside the.txt file name. Example:
- Marina
- Truthful
- Kiki
- Nautila
- Keila
- Brenda
- Patrick
- Nilton
I know the real problem is the way I’m trying to do it. See the code:
Shell Script
#!/bin/sh
#
# apagar arquivo, se existir
[ -e saida.html ] && rm -f saida.html
cat link.txt | while read LINK
do
cat foto.txt | while read FIGURA
do
cat legenda.txt | while read LEGENDA
do
cat nome.txt | while read NOME
do
echo -e "<html>\n<body>\n<a href='$LINK'><img src='$LINK/$FIGURA' alt='$LEGENDA' title='$NOME'/></a>\n</body>\n</html>"
done
done
done
done >> saida.html
cat saida.html
The problem is how to insert each line in a new line of the final file
This output file [the final -or- new file] is generated with doubling several times until the end of the last loop is exhausted(while
).
Does anyone know a way to fix this? Or another better method, to be able to do this?
It was really that. Accept my Up vote followed by my Absolute Vote. Removed my doubts and fixed my problem. Obg!
– Diego Henrique