I'm not sure I understand what you're trying to do either, but I think the following awk script does what your examples seem to request.
With the following in the file named input:
the output produced is:
As always, if you're running on a Solaris/SunOS system, use /usr/xpg4/bin/awk or nawk instead of awk.
Last edited by Don Cragun; 03-22-2013 at 07:12 PM..
This User Gave Thanks to Don Cragun For This Post:
Hello,
So i have this file called /apps/turnout which looks like that of the contents of the /etc/shadow (but not exactly)
the file has a long list in it. basically, the contents of this file looks something similar to the following:
jajajajalala:D#$#AFVAdfda
lalabavisof:#%R@fafla#$... (3 Replies)
i am new user of unix.i have a question.My script is-
export STR_ALFA=`head -2 "${FILE_PATH}"|tail -1|cut -d"," -f1`
"${TEST_HOME}"/function/chk_alfa.ksh STR_ALFA
now i want to check STR_ALFA:
1)whether is alphabetic
2)whether is numeric
3)whether is alphanumeric... (1 Reply)
Hi,
I wish to find all lines that contain a specific search word, and then do few string operations on that line. The idea is to "fix" the file which has been moved from windows to unix.
Using unix - Sun Solaris
Test input ("t2.sas")
statement1
statement2
libname yahoo ... (6 Replies)
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Dear All,
I am having a requirement to find the difference between 2 files and generate a discrepancy report out of it as an html page. I prefer using diff -y file1 file2 since it gives user friendly layout to know any discrepancy in the record and unique records among the 2 file. Here's how it... (12 Replies)
Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file:
</member>
<member>
<name>TransactionID</name>
<value><string>123456789123456</string></value>
</member>
<member>
<name>Number</name>
... (9 Replies)
Hi all,
Saying we have two files:
1. A "Reference File" whose content is "Variable Name": "Variable Value"
2. A "Model File" whose content is a model program in which I want to substitute "VariableName" with their respective value to produce a third file "Program File" which would be a... (4 Replies)
Hi, I'm not very familiar witrh sed or awk and hope the somebody can help me to solve my problem. I need to filter a text report using grep, sed or awk. I would like to cut out text lines with the pattern INFO and if exists the following lines of the pattern DETAILS. I need te keep the lines with... (4 Replies)
Discussion started by: Frankg
4 Replies
LEARN ABOUT PHP
yaf_router
YAF_ROUTER(3) 1 YAF_ROUTER(3)The Yaf_Router classINTRODUCTION
Yaf_Router is the standard framework router. Routing is the process of taking a URI endpoint (that part of the URI which comes after the
base URI: see Yaf_Request_Abstract::setBaseUri) and decomposing it into parameters to determine which module, controller, and action of
that controller should receive the request. This values of the module, controller, action and other parameters are packaged into a
Yaf_Request_Abstract object which is then processed by Yaf_Dispatcher. Routing occurs only once: when the request is initially received and
before the first controller is dispatched. Yaf_Router is designed to allow for mod_rewrite-like functionality using pure PHP structures. It
is very loosely based on Ruby on Rails routing and does not require any prior knowledge of webserver URL rewriting. It is designed to work
with a single Apache mod_rewrite rule (one of):
Example #1
Rewrite rule for Apache
RewriteEngine on
RewriteRule !.(js|ico|gif|jpg|png|css|html)$ index.php
or (preferred):
Example #2
Rewrite rule for Apache
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
If using Lighttpd, the following rewrite rule is valid:
Example #3
Rewrite rule for Lighttpd
url.rewrite-once = (
".*?(.*)$" => "/index.php?$1",
".*.(js|ico|gif|jpg|png|css|html)$" => "$0",
"" => "/index.php"
)
If using Nginx, use the following rewrite rule:
Example #4
Rewrite rule for Nginx
server {
listen ****;
server_name yourdomain.com;
root document_root;
index index.php index.html;
if (!-e $request_filename) {
rewrite ^/(.*) /index.php/$1 last;
}
}
DEFAULT ROUTE
Yaf_Router comes preconfigured with a default route Yaf_Route_Static, which will match URIs in the shape of controller/action. Addition-
ally, a module name may be specified as the first path element, allowing URIs of the form module/controller/action. Finally, it will also
match any additional parameters appended to the URI by default - controller/action/var1/value1/var2/value2.
Note
Module name must be defined in config, considering application.module="Index,Foo,Bar", in this case, only index, foo and bar can be
considerd as a module name. if doesn't config, there is only one module named "Index".
Some examples of how such routes are matched:
Example #5
Yaf_Route_Static(default route)example
// Assuming the following configure:
$conf = array(
"application" => array(
"modules" => "Index,Blog",
),
);
Controller only:
http://example/news
controller == news
Action only(when defined yaf.action_prefer=1 in php.ini)
action == news
Invalid module maps to controller name:
http://example/foo
controller == foo
Module + controller:
http://example/blog/archive
module == blog
controller == archive
Module + controller + action:
http://example/blog/archive/list
module == blog
controller == archive
action == list
Module + controller + action + params:
http://example/blog/archive/list/sort/alpha/date/desc
module == blog
controller == archive
action == list
sort == alpha
date == desc
CLASS SYNOPSIS
Yaf_Router
Yaf_Router
Properties
o protected$_routes
o protected$_current
Methods
o public bool Yaf_Router::addConfig (Yaf_Config_Abstract $config)
o public bool Yaf_Router::addRoute (string $name, Yaf_Route_Abstract $route)
o public Yaf_Router::__construct (void )
o public string Yaf_Router::getCurrentRoute (void )
o public Yaf_Route_Interface Yaf_Router::getRoute (string $name)
o public mixed Yaf_Router::getRoutes (void )
o public bool Yaf_Router::route (Yaf_Request_Abstract $request)
PROPERTIES
o $_routes
- registered routes stack
o $_current
- after routing phase, this indicated the name of which route is used to route current request. you can get this name by
Yaf_Router::getCurrentRoute.
PHP Documentation Group YAF_ROUTER(3)