Perl script to search and extract using wildcards.
Good evening All,
I have a perl script to pull out all occurrences of a files beginning with xx and ending in .p. I will then loop through all 1K files in a directory. I can grep for xx*.p files but it gives me the entire line. I wish to output to a single colum with only the hits found. This script needs to search for more than one occurrence per line regardless of the position or surrounding text.
Desired output:
Output
Any help would be appreciated.
Thank you,
Cammy
Last edited by Yogesh Sawant; 04-20-2009 at 05:15 AM..
Reason: added code tags
Hi there,
is it possible to use wild cards in this statement
ssh $remote_server 'perl -pi -e "s,EXP_SERIAL_19b8be67=\"\",EXP_SERIAL_`hostid`=\"UNKNOWN\"," /var/myfile'
This command works fine but the bit in bold (the 8 character hostid) will not always be 19b8be67 so I was hoping I could... (2 Replies)
Hi,
I am writing a Perl script that reads in many lines, if a line meets the criteria I want to edit, it. For example, the script will return the following example line... test=abc123
All I want to do is strip off the "test=" and just be left with the abc123. In my script I can easily... (3 Replies)
I have a question regarding Perl scripting.
If I want to say open files that all look like this and assign them to a filehandle and then assign the filehandle to a variable, how do I do this?
The file names are
strand1.fa.gz.tmp
strand2.fa.gz.tmp
strand3.fa.gz.tmp
strand4.fa.gz.tmp
...... (6 Replies)
Can Anyone tell me how to extract the second column of a xls sheet
And compare the content of each row of the column with a .h file.
xls sheet is having only one spreadsheet. (2 Replies)
Hi
I have 2 directories t1 and t2 with some files in it. I have to see whether the files present in t1 is also there in t2 or not. Currently, both the directories contain the same files as shown below:
$ABC.TXT
def.txt
Now, when I run the below script, it tells def.txt is found,... (5 Replies)
Hi, my problem is that I have two files. File no. 1 is a gff text file (say gi1) that has gene information like :
********************
gene 39389788..39395643
/gene="RPSA"
/note="Derived by automated computational analysis using
... (2 Replies)
I have hundreds of files to process. In each file
I need to look for a pattern then
extract value(s) from next line and then
search for value(s) selected from point (2) in the same file at a specific position.
HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V
TITLE CYTOCHROME... (7 Replies)
Hi everyone,
I'm a perl newbie and need your help to extract a word inside the list of files with same pattern.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:mycode xmlns:ns2="http://www.abcd.com/pqrs/acfSchema-2007a.xsd">
<id>10</id>
<name>PaymentServices</name>
... (7 Replies)
Hi,
I have a log file which is the output from a xml script :
<?xml version="1.0" ?>
<!DOCTYPE svc_result SYSTEM "MLP_SVC_RESULT_320.DTD">
<svc_result ver="3.2.0">
<slia ver="3.0.0">
<pos>
<msid type="MSISDN" enc="ASC">8093078040</msid>
<poserr>
... (4 Replies)
Discussion started by: arjunstarz
4 Replies
LEARN ABOUT DEBIAN
sdfapi
SDFAPI(1) User Contributed Perl Documentation SDFAPI(1)NAME
sdfapi - API Extraction Utility
PURPOSE
sdfapi extracts Application Programming Interface information from (Perl) source code.
USAGE
usage : sdfapi [-h[help]] [-o[out_ext]]
[-l[log_ext]] [-O[out_dir]] [-f fmt_tag]
[-p[pattern]] [-s sym_type,..] [-j]
file ...
purpose: extract the API from a (perl) library
version: 2.000 (SDF 2.001)
The options are:
Option Description
-h display help on options
-o output file extension
-l log file extension
-O output to input file's (or explicit) directory
-f output format tag
-p only symbols matching pattern
-s only symbols of these types
-j add SDF-style hypertext jumps from each symbol
DESCRIPTION
The -h option provides help. If it is specified without a parameter, a brief description of each option is displayed. To display the
attributes for an option, specify the option letter as a parameter.
By default, generated output goes to standard output. To direct output to a file per input file, use the -o option to specify an extension
for output files. If the -o option is specified without a parameter, an extension of out is assumed.
Likewise, error messages go to standard error by default. Use the -l option to create a log file per input file. If the -l option is
specified without a parameter, an extension of log is assumed.
By default, generated output and log files are created in the current directory. Use the -O option to specify an explicit output directory.
If the -O option is specified without a parameter, the input file's directory is used.
The format of the output can be controlled using the -f option. Supported formats are std and concise. The default is std. std format is:
require "abc.pl";
$myvar = ...
$result = &myfunc($myparams);
concise format has fewer blank lines and uses 1 line per symbol.
A comma-separated list of symbol types to output can be specified using the -s option. Supported symbol types are:
o sub - subroutines
o var - variables
The default is to extract all symbols.
The -p option is used to extract only a subset of the symbols. If not supplied, the pattern is symbols beginning with a letter. If supplied
without an option, the pattern defaults to all symbols. If perl libraries use the coding convention that symbols beginning with underscore
are private, then -p_ can be used to extract the private symbols.
The -j option can be used to request SDF-style hypertext jumps be added for each symbol. The jump target is lib_sym where:
o lib is the library name
o sym is the symbol name.
LIMITATIONS AND FUTURE DIRECTIONS
The only language currently supported is Perl.
It would be useful to extract messages from the scripts too. This would require a new utility called sdfmsg say, which searched through the
source (including libraries) for AppMsg and AppExit calls.
Internally, it may be better to implement formats via routines. This would give better control over output. e.g. it would be up to the
routine to decide if it wanted to output the 'require' header.
perl v5.12.4 2011-11-09 SDFAPI(1)