Sponsored Content
Top Forums Shell Programming and Scripting Awk - find string, search lines below string for other strings Post 302509058 by yinyuemi on Tuesday 29th of March 2011 05:17:41 PM
Old 03-29-2011
Code:
awk '/<VirtualHost \*:>|ServerName|DocumentRoot/{print}' file
<VirtualHost *:>
        ServerName server.name1.com
<VirtualHost *:>
        ServerName www.servername2
        DocumentRoot /location/of/document/root

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search multiple strings on a file and copy the string next to it

I tried awk for this, but failed <or my code is not correct? I dont know>. Can anyone help me on this? ---------- Post updated at 08:34 PM ---------- Previous update was at 08:29 PM ---------- my working file looks like this: <empty> <empty> <empty> NAME :ABC AGE :15 GENDER... (6 Replies)
Discussion started by: kingpeejay
6 Replies

2. Shell Programming and Scripting

search string in a file and retrieve 10 lines including string line

Hi Guys, I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same. can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies

3. Shell Programming and Scripting

Find a string in textfile, erase $num lines after that string

I have a textfile containing text similar to the following pattern: STRING1 UNIQUE_STRING1 STRING2 STRING3 STRING4 STRING5 STRING1 UNIQUE_STRING2 STRING2 STRING3 STRING4 STRING5 STRING1 UNIQUE_STRING3 STRING2 STRING3 (6 Replies)
Discussion started by: ilcsfe
6 Replies

4. Solaris

Search string between the strings

File name : Sample.txt <ownername>Oracle< ownername> I am new to unix world , i would like to search string and return back to another sh script. bascially i want to read file Sample.txt find the string between <ownername> Sample.txt < ownername> . Gerneric way to find the string... (15 Replies)
Discussion started by: balajikalai
15 Replies

5. Shell Programming and Scripting

awk find a string, print the line 2 lines below it

I am parsing a nagios config, searching for a string, and then printing the line 2 lines later (the "members" string). Here's the data: define hostgroup{ hostgroup_name chat-dev alias chat-dev members thisisahostname } define hostgroup{ ... (1 Reply)
Discussion started by: mglenney
1 Replies

6. Shell Programming and Scripting

awk search an output string between two strings

I would like to search for strings stored in searchstringfile.txt in inputfiles. searchstringfile.txt J./F. Gls. Wal F. Towerinput1.txt What is needed is J./F. 12 var Gls. Wal 16 interp. Tower 12 input2.txt Awk shall search for F. 16 pt. J./F. 22 output.txt input1.txt J./F. = 12 var... (3 Replies)
Discussion started by: sdf
3 Replies

7. Shell Programming and Scripting

Search a string and replace the same string above two lines?.

I need to search this "<CardinalMPI>" string and replace the same string above two lines of the string. Nov 16, 2012 12:58:34 PM INFO: Centinel LookUp ResponseXML : <CardinalMPI> <ReasonCode></ReasonCode> <ErrorDesc></ErrorDesc> <MerchantReferenceNumber></MerchantReferenceNumber>... (4 Replies)
Discussion started by: laknar
4 Replies

8. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

9. Shell Programming and Scripting

Search String and extract few lines under the searched string

Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed Bold letters are the stations . The whole file has multiple stations . Below example i wanted to search... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

10. Shell Programming and Scripting

Find a string and print all lines upto another string

Ok I would like to do the following file test contains the following lines. between the lines ABC there may be any amount of lines up to the next ABC entry. I want to grep for the filename.txt entry and print the lines in between (and including that line) up to and including the last line... (3 Replies)
Discussion started by: revaroo
3 Replies
BOA(8)							      System Manager's Manual							    BOA(8)

NAME
boa - a single-tasking high performance http server SYNOPSIS
boa [-c server_root] [-r chroot] [-d] DESCRIPTION
Boa is a single-tasking HTTP server. That means that unlike traditional web servers, it does not fork for each incoming connection, nor does it fork many copies of itself to handle multiple connections. It internally multiplexes all of the ongoing HTTP connections, and forks only for CGI programs (which must be separate processes.) Preliminary tests show Boa is more than twice as fast as Apache. The primary design goals of Boa are speed and security. Security, in the sense of "can't be subverted by a malicious user", not "fine grained access control and encrypted communications". Boa is not intended as a feature-packed server; if you want one of those, check out WN from John Franks. Modifications to Boa that improve its speed, security, robustness, and portability, are eagerly sought. Other features may be added if they can be achieved without hurting the primary goals. OPTIONS
-d instruct Boa not to fork itself (non-daemonize). -c server_root choose a server root overriding the default SERVER_ROOT #define in defines.h The server root must hold your local copy of the configuration file -r chroot instruct Boa where to chdir and chroot to. The chdir/chroot is done before the configuration file is read, or any log files are opened. FILES
boa.conf - the sole configuration file for Boa. The directives in this file are defined in the DIRECTIVES section. mime.types - the MimeTypes <filename> defines what Content-Type Boa will send in an HTTP/1.0 or better transaction. DIRECTIVES
The Boa configuration file is parsed with a lex/yacc or flex/bison generated parser. If it reports an error, the line number will be pro- vided; it should be easy to spot. The syntax of each of these rules is very simple, and they can occur in any order. Where possible, these directives mimic those of NCSA httpd 1.3; We saw no reason to introduce gratuitous differences. Note: the "ServerRoot" is not in this configuration file. It can be compiled into the server (see defines.h ) or specified on the command line with the -c option. The following directives are contained in the boa.conf file, and most, but not all, are required. Port <integer> This is the port that Boa runs on. The default port for http servers is 80. If it is less than 1024, the server must be started as root. User <user name or UID> The name or UID the server should run as. For Boa to attempt this, the server must be started as root. Group <group name or GID> The group name or GID the server should run as. For Boa to attempt this, the server must be started as root. ServerAdmin <email address> The email address where server problems should be sent. Note: this is not currently used. PidFile <filename> Where to put the pid of the process. Comment out to write no pid file. Note: Because Boa drops privileges at startup, and the pid file is written by the UID/GID before doing so, Boa does not attempt removal of the pid file. ErrorLog <filename> The location of the error log file. If this does not start with /, it is considered relative to the server root. Set to /dev/null if you don't want errors logged. AccessLog <filename> The location of the access log file. If this does not start with /, it is considered relative to the server root. Comment out or set to /dev/null (less effective) to disable access logging. VerboseCGILogs This is a logical switch and does not take any parameters. Comment out to disable. CGILog <filename> The location of the CGI error log file. If this does not start with /, it is considered relative to the server root. If specified, this is the file that the stderr of CGIs is tied to, *instead* of to the ErrorLog. CGIumask <umask> The CGIumask is set immediately before execution of the CGI. The default value is 027. The number must be interpretable unambigu- ously by the C function strtol. No base is specified, so one may use a hexadecimal, decimal, or octal number if it is prefixed accordingly. ServerName <server_name> The name of this server that should be sent back to clients if different than that returned by gethostname. VirtualHost This is a logical switch and does not take any parameters. Comment out to disable. Given DocumentRoot /var/www, requests on inter- face 'A' or IP 'IP-A' become /var/www/IP-A. Example: http://localhost/ becomes /var/www/127.0.0.1 VHostRoot <directory> The root location for all virtually hosted data Comment out to disable. Incompatible with 'Virtualhost' and 'DocumentRoot'!! Given VHostRoot /var/www, requests to host foo.bar.com, where foo.bar.com is ip a.b.c.d, become /var/www/a.b.c.d/foo.bar.com Hostnames are "cleaned", and must conform to the rules specified in rfc1034, which are be summarized here: Hostnames must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen. Hostnames must not exceed 63 characters in length. DefaultVHost <hostname> Define this in order to have a default hostname when the client does not specify one, if using VirtualHostName. If not specified, the word "default" will be used for compatibility with older clients. DocumentRoot <directory> The root directory of the HTML documents. If this does not start with /, it is considered relative to the server root. UserDir <directory> The name of the directory which is appended onto a user's home directory if a ~user request is received. DirectoryIndex <filename> Name of the file to use as a pre-written HTML directory index. Please make and use these files. On the fly creation of directory indexes can be slow. DirectoryMaker <directory> Name of the program used to generate on-the-fly directory listings. The program must take one or two command-line arguments, the first being the directory to index (absolute), and the second, which is optional, contains what Boa would have the "title" of the document be. Comment out if you don't want on the fly directory listings. If this does not start with /, it is considered relative to the server root. KeepAliveMax <integer> Number of KeepAlive requests to allow per connection. Comment out, or set to 0 to disable keepalive processing. KeepAliveTimeout <integer> Number of seconds to wait before keepalive connections time out. MimeTypes <file> The location of the mime.types file. If this does not start with /, it is considered relative to the server root. Set to /dev/null if you do not want to load a mime types file. Do *not* comment out (better use AddType!) DefaultType <mime type> MIME type used if the file extension is unknown, or there is no file extension. AddType <mime type> <extension> [extension...] Associates a MIME type with an extension or extensions. Redirect, Alias, and ScriptAlias <path1> <path2> Redirect, Alias, and ScriptAlias all have the same semantics -- they match the beginning of a request and take appropriate action. Use Redirect for other servers, Alias for the same server, and ScriptAlias to enable directories for script execution. Redirect allows you to tell clients about documents which used to exist in your server's namespace, but do not anymore. This allows you tell the clients where to look for the relocated document. Alias aliases one path to another. Of course, symbolic links in the file system work fine too. ScriptAlias maps a virtual path to a directory for serving scripts. Please see the included boa.conf for defaults and examples. HISTORY
Like the Linux kernel, even numbered versions are "stable", and odd numbered versions are "unstable", or rather, "development". Versions 0.91 and 0.91beta of Boa were released by Paul Phillips <paulp@go2net.com> Version 0.92 was released by Larry Doolittle on December 12, 1996. Version 0.93 was the development version of 0.94. Version 0.94 was released 22 Jan 2000. BUGS
There are probably bugs, but we are not aware of any at this time. AUTHOR
Boa was created by Paul Phillips <paulp@go2net.com>. It is now being maintained and enhanced by Larry Doolittle <ldoolitt@boa.org> and Jon Nelson <jnelson@boa.org>. Linux is the development platform at the moment, other OS's are known to work. If you'd like to contribute to this effort, contact Larry or Jon via e-mail. LICENSE
This program is distributed under the GNU General Public License, as noted in each source file. Version 0.94 Jan 22 2000 BOA(8)
All times are GMT -4. The time now is 12:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy