LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-11-2005, 03:29 AM   #1
@ngelot
Member
 
Registered: Oct 2004
Posts: 84

Rep: Reputation: 15
SSI include line from text-file?


I'm running an apache 1.3 server with the SSI-function enabled.

I run (in my HTML-code) ssi like this:
Code:
<!--#include virtual="menu.txt"-->
How do I get it to print out a single line in a file?

Something like:
Code:
<!--#include virtual="menu.txt#line2"-->
So that only line 2 in menu.txt are included on the page?

Can I do this with SSI? Do I need a script (cgi/perl)?

Thanks!

@ngelot
 
Old 05-11-2005, 04:23 AM   #2
@ngelot
Member
 
Registered: Oct 2004
Posts: 84

Original Poster
Rep: Reputation: 15
I've tried this:
Code:
<!--#exec cmd="grep name  /var/www/text.txt" -->
and the output is:
Code:
name My Name
How can I skip the "name" bit, so that output of the grep-cmd is only:
Code:
My name
@ngelot
 
Old 05-11-2005, 06:34 AM   #3
jeffreybluml
Member
 
Registered: Mar 2004
Location: Minnesota
Distribution: Fedora Core 1, Mandrake 10
Posts: 405

Rep: Reputation: 30
I guess you could do
<!--#exec cmd="grep name /var/www/text.txt | sed 's/name\ //g' " -->

That what you're looking for?
 
Old 05-11-2005, 06:40 AM   #4
@ngelot
Member
 
Registered: Oct 2004
Posts: 84

Original Poster
Rep: Reputation: 15
Yess!

That's it! Thanks!

@ngelot
 
Old 05-11-2005, 06:43 AM   #5
jeffreybluml
Member
 
Registered: Mar 2004
Location: Minnesota
Distribution: Fedora Core 1, Mandrake 10
Posts: 405

Rep: Reputation: 30
No prob!

sed is the greatest utility I've learned in linux...as far as file editing/manipulation goes...
 
  


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
C++ text file line by line/each line to string/array Dimitris Programming 15 03-11-2008 08:22 AM
CGI works from SSI exec, but not from include. SkipHuffman Linux - Software 2 08-25-2005 10:15 PM
SSI works from #exec, but not from #include. SkipHuffman Linux - General 4 08-25-2005 07:16 AM
Include ssi in a form? @ngelot Programming 4 05-11-2005 07:39 AM
View Line In Text File DaveyB Programming 1 11-03-2004 12:02 PM

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

All times are GMT -5. The time now is 04:26 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