Personal computing discussed
Moderators: renee, SecretSquirrel, notfred
SecretSquirrel wrote:Awk is your friend too...
ls -1 | awk '{print "<img src=\""$1"\"/>"}'
--SS
flip-mode wrote:Yes, there are a ton of ways to do just about anything in the Unix world. I'm quite surprised - and thankful - that nobody has posted a perl version as well.Wow, is there such a thing as having too many friends
notfred wrote:flip-mode wrote:Yes, there are a ton of ways to do just about anything in the Unix world. I'm quite surprised - and thankful - that nobody has posted a perl version as well.Wow, is there such a thing as having too many friends
notfred wrote:I think most of us here are not complete maniacs and therefore prefer Python to Perl.Yes, there are a ton of ways to do just about anything in the Unix world. I'm quite surprised - and thankful - that nobody has posted a perl version as well.
import os
lst = ['<img src="' + f + '"/>' for f in os.listdir(".") if os.path.isfile(f)]
for f in lst:
print(f)
notfred wrote:flip-mode wrote:Yes, there are a ton of ways to do just about anything in the Unix world. I'm quite surprised - and thankful - that nobody has posted a perl version as well.Wow, is there such a thing as having too many friends
Usacomp2k3 wrote:When I come upon a similar type of situation, I usually take a slightly different (window-centric) approach.
1/ dir /b -> output.html
2/ open up the output.html in notepad
3/ copy the lines into excel
4/ add whatever formatting I want (whether that be splitting up the file to give both a url and an image tags)
5/ copy it back into notepad
just brew it! wrote:Usacomp2k3 wrote:When I come upon a similar type of situation, I usually take a slightly different (window-centric) approach.
1/ dir /b -> output.html
2/ open up the output.html in notepad
3/ copy the lines into excel
4/ add whatever formatting I want (whether that be splitting up the file to give both a url and an image tags)
5/ copy it back into notepad
...and I think you've indirectly illustrated why many people who make the jump to *NIX eventually come to prefer it. The Windows-centric approach is easier to do the first time; but harder to automate with a script.
just brew it! wrote:Usacomp2k3 wrote:When I come upon a similar type of situation, I usually take a slightly different (window-centric) approach.
1/ dir /b -> output.html
2/ open up the output.html in notepad
3/ copy the lines into excel
4/ add whatever formatting I want (whether that be splitting up the file to give both a url and an image tags)
5/ copy it back into notepad
...and I think you've indirectly illustrated why many people who make the jump to *NIX eventually come to prefer it. The Windows-centric approach is easier to do the first time; but harder to automate with a script.