using sed on a moxa linux embedded computer

6
Using sed on a Moxa Linux Embedded Computer: A CGI Exercise sed is a stream editor for filtering and transforming text in Linux. In the example below, you can write a script with sed to find a matched pattern, Input, and replace with the substituted string Output. Fig. 1: sed is a stream editor In this article we will take advantage of a shell script with the sed command to write a small CGI (Common Gateway Interface) program to change the hostname. There are two files created in this exercise. One is an html web page (hostname.htm) for the user to input a new host name, the other is the executable CGI program (hostname.cgi) to get the new host name and configure it on the system. Seting up the Web Page on a Moxa Embedded Computer In this exercise, we will change the host name using the Apache web server. However, the default user of the web server nobodydoes not have the permissions to change the host name. Hence, before starting up the Apache web server, you need to modify the configuration file /etc/apache/conf/httpd.conf to run the Apache server as root. Input line will be changed Output line will be changed Pattern: Input Substitute: Output sed

Upload: rcorecommunity

Post on 18-Nov-2014

448 views

Category:

Technology


1 download

DESCRIPTION

See More Embedded Computer White Papers by Visiting http://www.moxa.com/Resource/whitepapers.aspx

TRANSCRIPT

Hostname configure Hostname: