10-25-2011
perl script print the lines between two pattern
i have a file as below
sample.pl
parameter1
argument1
argument2
parameter2
I want out as below
argument1
argument2
that is , i want to print all the lines between parameter1 & parameter 2.
i tried with the following
if($mystring =~ m/parameter1(.*?)parameter2/)
I want the output should be written in another file.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i have 2 lines comming out of a script o/p.below the line.
2008-10-14 05:47:05,551 INFO - LPBatch:
2008-10-14 05:47:05,575 INFO - Number of Intervals Not Inserted: 1 / 95
--------------------------------------------------------------------------
How to print the below o/p from the... (2 Replies)
Discussion started by: ali560045
2 Replies
2. UNIX for Dummies Questions & Answers
hi,
I have a file say x.txt containing
xxx
123
bla
bla
...
you
xxx
dfk
dbf
...
me
xxx
...
...
keeps on..
i need to search for pattern in the line starting xxx in the file. If pattern matched, I need to fetch all the lines till i find next xxx. (17 Replies)
Discussion started by: prsshini
17 Replies
3. Shell Programming and Scripting
Hi
I have a file (say 'file1')and I want to search for a first occurence of pattern (say 'ERROR') and print ten lines in the file below pattern. I have to code it in PERL and I am using Solaris 5.9.
I appreciate any help with code
Thanks
Ammu (6 Replies)
Discussion started by: ammu
6 Replies
4. Shell Programming and Scripting
Hi Friends,
I am working on a script.. Looking forward for your expert help.....
My requirement is:
I have a text file where, need to search equip * RTF or end of line with RTF ,once this pattern is found then print 2nd line, 6th line, 7th line to a different file.
For Ex:
equip 1... (34 Replies)
Discussion started by: shaliniyadav
34 Replies
5. Shell Programming and Scripting
11
22
33
44
55
66
77
When pattern 55 is met, print upto it, so output is
11
22
33
44 (1 Reply)
Discussion started by: anilcliff
1 Replies
6. Shell Programming and Scripting
i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies
7. Linux
Hi all,
I have a text data file. My aim here is to find line called *FIELD* AV for every record and print lines after that till *FIELD* RF. But here I want first 3 to four lines for very record as well. FIELD AV is some where in between for very record. SO I am not sure how to retrieve lines in... (2 Replies)
Discussion started by: kaav06
2 Replies
8. Shell Programming and Scripting
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies
9. Shell Programming and Scripting
The intended result should be :
PDF converters
'empty line'
gpdftext and pdftotext?xml version="1.0"?>
xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters
gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies
10. Shell Programming and Scripting
would like to print everything after matching two patterns AAA and BBB.
output :
CCC
ZZZ
sample data :
AAA
BBB
CCC
ZZZ (4 Replies)
Discussion started by: jhonnyrip
4 Replies
LEARN ABOUT OPENDARWIN
pkgparam
pkgparam(1) User Commands pkgparam(1)
NAME
pkgparam - display package parameter values
SYNOPSIS
pkgparam [-v] [-d device] [-R root_path] pkginst [param...]
pkgparam -f filename [-v] [param...]
DESCRIPTION
pkgparam displays the value associated with the parameter or parameters requested on the command line. The values are located in either the
pkginfo(4) file for pkginst or from the specific file named with the -f option.
One parameter value is shown per line. Only the value of a parameter is given unless the -v option is used. With this option, the output of
the command is in this format:
parameter1='value1'
parameter2='value2'
parameter3='value3'
If no parameters are specified on the command line, values for all parameters associated with the package are shown.
OPTIONS
Options and arguments for this command are:
-d device Specify the device on which a pkginst is stored. It can be a directory pathname or the identifiers for tape, floppy disk,
or removable disk (for example, /var/tmp, /dev/diskette, and /dev/dsk/c1d0s0). The special token spool may be used to rep-
resent the default installation spool directory (/var/spool/pkg).
-f filename Read filename for parameter values.
-R root_path Defines the full path name of a subdirectory to use as the root_path. All files, including package system information
files, are relocated to a directory tree starting in the specified root_path.
-v Verbose mode. Display name of parameter and its value.
OPERANDS
pkginst Defines a specific package instance for which parameter values should be displayed.
param Defines a specific parameter whose value should be displayed.
ERRORS
If parameter information is not available for the indicated package, the command exits with a non-zero status.
EXIT STATUS
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
pkgmk(1), pkgproto(1), pkgtrans(1), pkginfo(4), attributes(5)
Application Packaging Developer's Guide
NOTES
With the -f option, you can specify the file from which parameter values should be extracted. This file should be in the same format as a
pkginfo(4) file. For example, such a file might be created during package development and used while testing software during this stage.
SunOS 5.10 6 Nov 2000 pkgparam(1)