Sponsored Content
Top Forums Shell Programming and Scripting Perl REGEX - How do extract a string in a line? Post 302345591 by sweetblood on Wednesday 19th of August 2009 04:03:46 PM
Old 08-19-2009
/^cn=([^,]*?),/
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how do i strip this line using perl regex.

I have a variable dynamically generated $batch = /dataload/R3P/interface/Bowne/reports/RDI00244.rpt Now I'd like to strip '/dataload/R3P/interface/Bowne/reports/RDI' and '.rpt' from this variable my output should be only 00244 how to do this using perl regex.I'm a newbie to perl and would... (1 Reply)
Discussion started by: ramky79
1 Replies

2. Shell Programming and Scripting

Perl Regex string opperation

I'm working on a basic log parser in perl. Input file looks like: len: 120713 foo bar file size of: testdir1/testdir1/testdir1/testdir1/testfile0 is 120713Of course there are tens of thousands of lines... I'm trying to compare the len and filesize values. #!/usr/bin/perl use strict; use... (2 Replies)
Discussion started by: dkozel
2 Replies

3. Shell Programming and Scripting

Perl Extract String

Hi, I have a string like "something is good wanted (bla bla)" I need to get the world "wanted" from this string and "assign it to a variable".. but it's not a static word so i want to get that word by searching the pattern as follows <space>desiredword<space>( and i tried to get that... (6 Replies)
Discussion started by: xlynx3
6 Replies

4. Shell Programming and Scripting

perl regex multi line cut

hello mighty all there's a file with lots of comments.. some of them looks like: =comment blabla blablabla bla =cut i'm trying to cut this out completely with this code: $line=~s/^=.+?=cut//sg; but no luck also tryed to change it abit but still I don't understand how the... (9 Replies)
Discussion started by: tip78
9 Replies

5. Shell Programming and Scripting

Perl: Regex, string matching

Hi, I've a logfile which i need to parse and get the logs depending upon the user input. here, i'm providing an option to enter the string which can be matched with the log entries. e.g. one of the logfile entry reads like this - $str = " mpgw(BLUESOAPFramework):... (6 Replies)
Discussion started by: butterfly20
6 Replies

6. Shell Programming and Scripting

Perl regex to remove a segment in a line

Hello, ksh on Sun5.8 here. I have a pipe-delimited, variable length record file with sub-segments identified with a tilda that we receive from a source outside of our control. The records are huge, and Perl seems to be the only shell that can handle the huge lines. I am new to Perl, and am... (8 Replies)
Discussion started by: gary_w
8 Replies

7. Shell Programming and Scripting

perl regex string match issue..kindly help

i have a script in which i need to skip comments, and i am able to achieve it partially... IN text file: {**************************** {test : test...test } Script: while (<$fh>) { push ( @data, $_); } if ( $data =~ m/(^{\*+$)/ ){ } With the above match i am... (5 Replies)
Discussion started by: avskrm
5 Replies

8. Shell Programming and Scripting

Perl to extract information from a file line by line

In the below perl code I am using tags within each line to extract certain information. The tags that are used are: STB >0.8 is STRAND BIAS otherwise GOOD FDP is the second number GO towards the end of the line is read into an array and the value returned is outputed, in the first line that... (1 Reply)
Discussion started by: cmccabe
1 Replies

9. Shell Programming and Scripting

Perl to extract whole number or decimal in regex

In the perl below I am trying to extract and print specic values from patterns using multiple regex. One of the patterns AF= may be a whole number or a decimal but I can not seem to capture both. I think it is the regex .*AF=(\d+\.\d+); as it is expecting a #.#### and it may only be a #. I tried... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. UNIX for Beginners Questions & Answers

Help with understanding this regex in a Perl script parsing a 'complex' string

Hi, I need some guidance with understanding this Perl script below. I am not the author of the script and the author has not leave any documentation. I supposed it is meant to be 'easy' if you're a Perl or regex guru. I am having problem understanding what regex to use :confused: The script does... (3 Replies)
Discussion started by: newbie_01
3 Replies
MOUNT_PORTAL(8) 					    BSD System Manager's Manual 					   MOUNT_PORTAL(8)

NAME
mount_portal -- mount the portal daemon SYNOPSIS
mount_portal [-o options] /etc/portal.conf mount_point DESCRIPTION
The mount_portal command attaches an instance of the portal daemon to the global filesystem namespace. The conventional mount point is /p. The directory specified by mount_point is converted to an absolute path before use. This command is normally executed by mount(8) at boot time. The options are as follows: -o Options are specified with a -o flag followed by a comma separated string of options. See the mount(8) man page for possible options and their meanings. The portal daemon provides an open service. Objects opened under the portal mount point are dynamically created by the portal daemon accord- ing to rules specified in the named configuration file. Using this mechanism allows descriptors such as sockets to be made available in the filesystem namespace. The portal daemon works by being passed the full pathname of the object being opened. The daemon creates an appropriate descriptor according to the rules in the configuration file, and then passes the descriptor back to the calling process as the result of the open system call. NAMESPACE
By convention, the portal daemon divides the namespace into sub-namespaces, each of which handles objects of a particular type. Currently, four sub-namespaces are implemented: tcp, fs, rfilter and wfilter. The tcp namespace takes a hostname and a port (slash sepa- rated) and creates an open TCP/IP connection. The fs namespace opens the named file, starting back at the root directory. This can be used to provide a controlled escape path from a chrooted environment. The rfilter and wfilter namespaces open a pipe to a process, typically a data-filter such as compression or decompression programs. The rfilter namespace opens a read-only pipe, while the wfilter namespace opens a write-only pipe. See the EXAMPLES section below for more exam- ples. CONFIGURATION FILE
The configuration file contains a list of rules. Each rule takes one line and consists of two or more whitespace separated fields. A hash (``#'') character causes the remainder of a line to be ignored. Blank lines are ignored. The first field is a pathname prefix to match against the requested pathname. If a match is found, the second field tells the daemon what type of object to create. Subsequent fields are passed to the creation function. The rfilter and wfilter namespaces have additional meanings for the remaining fields. The third field specifies a prefix that is to be stripped off of the passed name before passing it on to the pipe program. If the prefix does not match, no stripping is performed. The fourth argument specifies the program to use for the pipe. Any remaining fields are passed to the pipe program. If the string ``%s'' exists within these remaining fields, it will be replaced by the path after stripping is performed. If there is no field after the program name, ``%s'' will be assumed, to maintain similarity with the tcp and fs namespaces. FILES
/p/* EXAMPLES
A tutorial and several examples are provided in /usr/share/examples/mount_portal. The following is an example configuration file. # @(#)portal.conf 5.1 (Berkeley) 7/13/92 tcp/ tcp tcp/ fs/ file fs/ echo/ rfilter echo/ echo %s echo_nostrip/ rfilter nostrip echo %s echo_noslash rfilter echo_noslash echo %s gzcat/ rfilter gzcat/ gzcat %s gzip/ wfilter gzip/ gzip > %s gzip9/ wfilter gzip9/ gzip -9 > %s ftp/ rfilter ftp/ ftp -Vo - %s ftp:// rfilter nostrip ftp -Vo - %s http:// rfilter nostrip ftp -Vo - %s bzcat/ rfilter bzcat/ bzcat %s nroff/ rfilter nroff/ nroff -man %s As is true with many other filesystems, a weird sense of humor is handy. Notice that after the keynames, like nroff/ and bzcat/, we typically use another slash. In reality, the mount_portal process changes direc- tory to /, which makes the subsequent slash unnecessary. However, the extra slash provides a visual hint that we are not operating on an ordinary file. An alternative would be to change the configuration file to something like: nroff% rfilter nroff% nroff -man One might then use less /p/nroff%/usr/share/man/man8/mount_portal.8 SEE ALSO
mount(2), unmount(2), fstab(5), mount(8) HISTORY
The mount_portal utility first appeared in 4.4BSD. The rfilter and wfilter capabilities first appeared in NetBSD 1.5. The portal kernel driver was removed and mount_portal was converted to use puffs(3) in NetBSD 6.0. BUGS
This filesystem may not be NFS-exported. BSD
December 5, 2009 BSD
All times are GMT -4. The time now is 05:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy