LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-26-2007, 05:40 AM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Rep: Reputation: 255Reputation: 255Reputation: 255
noob: creating script to make webpage/img


I did a:

Code:
 ls -1 > list_of_jpeg.htm
Then, I would like to transform every lines of its content of this file like :
Code:
<a href=67878678678.jpeg>  <IMG SRC=67878678678.jpeg> </A>
<a href=62453538755657.jpeg>  <IMG SRC=62453538755657.jpeg> </A>


...
I am stuck with bash. The solution can it be done with bash/sh ?

Thanks

(==
We sometimes miss a basic (/bin/basic) like this one http://upload.wikimedia.org/wikipedi...sic_editor.png)
(I just found yabasic bwbasic)

Last edited by Xeratul; 05-26-2007 at 05:48 AM.
 
Old 05-26-2007, 05:55 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

You could do this with a oneliner:

ls *jpeg | sed 's%\(.*\)%<a href=\1> <IMG SRC=\1> </A>%' > jpeg.href.html

Or if you do need a actual script:
Code:
#!/bin/bash

ls *jpeg | sed 's%\(.*\)%<a href=\1> <IMG SRC=\1> </A>%' > jpeg.href.html
Both use sed to substitute the jpeg into the html line. This is done by backreferencing: This part \(.*\) tells sed that it should look for .* (everything on a line), the \( and \) are there to tell sed that you want to use the found part in the replacement part, which is done by using \1.

Hope this helps.
 
Old 05-26-2007, 06:06 AM   #3
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by druuna
Hi,

You could do this with a oneliner:

ls *jpeg | sed 's%\(.*\)%<a href=\1> <IMG SRC=\1> </A>%' > jpeg.href.html

Or if you do need a actual script:
Code:
#!/bin/bash

ls *jpeg | sed 's%\(.*\)%<a href=\1> <IMG SRC=\1> </A>%' > jpeg.href.html
Both use sed to substitute the jpeg into the html line. This is done by backreferencing: This part \(.*\) tells sed that it should look for .* (everything on a line), the \( and \) are there to tell sed that you want to use the found part in the replacement part, which is done by using \1.

Hope this helps.

thank you

in the mean time I found this
Pff ... Programmign is not soo easy... Let s make it




http://basic.mindteq.com/LinuxList.asp
Quote:
BlitzMax
BlitzMax is a new complete 2D/3D game programming language... A great number of programmers use this language and can help beginners...


Win, Linux, MacOS





BLOC
BLOC is a programming language which translates sources to Pascal code and compile them into stand-alone EXEs. It is multiplatform…


Win, Linux, QNX, PalmOS





Blunt Axe Basic
Blunt Axe Basic is a basic-like programming language that offers a console mode 32 bit compiler. The langauge is a subset of the QBasic/QuickBasic 4.5 dialect…


Win, Linux





Euphoria
Euphoria is a free Basic-like language compiler... It does not create GUI programs itself, but there are now a number of free libraries…


Win, Linux





FreeBasic
With FreeBasic the user need to know only DOS Basic. FreeBASIC is compatible with QBasic and QuickBasic... it may create OBJ, LIB, DLL, console and GUI EXEs…


Win, Linux





Gambas
Gambas is a Basic-like language with object extensions inspired by Java... Althought it does not complie to a real stand alone EXEs...


Linux





GNU Liberty Basic
The GNU/Liberty Basic Compiler Collection is a suite of free libraries to compile Liberty Basic code to a small and fast stand-alone application…


Win, Linux





Hbasic
HBasic is RAD Basic like language for Linux... Throught its complete and excellent IDE you may create, execute and fully debug programs…


Linux





Kbasic
KBasic is very similar to VisualBasic with some elements of Java... is well structured... but the language and the programming IDE is not stable…


Win, Linux





OmniBasic
OmniBasic has a good and intuitive IDE similar to Visualbasic but it is not a RAD... The language is simple to understand and the documentation is well written...


Win, Linux





Phoenix
Phoenix Object Basic is a RAD development tool... It's a fully object-oriented language... it offers a visual designer to build GUIs…


Win, Linux





PureBasic
Great programming Basic-like language... more the 600 commands...OpenGL and DirectX... assembly code directly in the source code... no RAD…


Win, Linux, Amiga, MacOS





RapidQ
Rapid-Q is a cross platform Basic free programming language... Thousands of programmers develope with it and are implementing new functions…


Win, Linux, Sun, HP-UX





RealBasic
Extremely well built, powerful and complete IDE. Very professional working environment RAD. Valid alternative to VisualBasic... Not so small EXEs…


Win, MacOs, Linux





ScriptBasic
Scriptbasic is language similar to Basic. It supports a rich set of instructions... Unfortunately Scriptbasic produces only console mode applications…


Win, Linux, Unix





SmallBasic
Smallbasic is a simple computer language... strong mathematics and graphics. It is not a developer tool for professional programmers…


Win, Linux, PalmOs, DOS





X11-Basic
X11-Basic is a Basic interpreter with full X graphic capability. The syntax is most similar to the old GFA-Basic ATARI ST implementation…


Linux, Unix





xBasic
Free Win32 and Linux Basic-like language... simple but complete programming language... The working environment is not really nice...


Win, Linux
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
make a .img file for custom liveCD, dd?? (Also, how to make your system very small) 1veedo Linux - Newbie 6 05-07-2006 05:52 PM
Creating a webpage for the first time metallica1973 Linux - Software 2 03-09-2006 10:09 PM
how do i make subdomains on my webpage matt_w_lambert Linux - General 2 10-29-2003 11:51 PM
Howto make own webpage js72 Linux - Software 4 02-12-2003 02:01 PM
Help requested on creating bootnet.img aravamudhan Linux - General 7 06-18-2002 08:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration