Sponsored Content
Top Forums Shell Programming and Scripting Perl script to search and extract using wildcards. Post 302308372 by KevinADC on Friday 17th of April 2009 09:48:57 PM
Old 04-17-2009
The biggest problem with your regexp is the greedy match .* but your search criteria is too vague to want to try and post any code. For example, why does asdfxx.p but not xx5.p? Of course your regexp will not match asdfxx.p anyway. Please post some real sample data and explain the search criteria in more detail.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using wildcards in this perl command

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)
Discussion started by: hcclnoodles
2 Replies

2. Shell Programming and Scripting

Perl Script Syntax to Extract Everything After Special Character

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)
Discussion started by: edrichard
3 Replies

3. Shell Programming and Scripting

Perl script to extract 'ID' From XML File

File1.xml <?xml version.........> - <abcd:abcd_list version="1" www.john_uncle's_server.com" xmlns: - <device id="100"> <firmware>12.4(3d)</firmware> <location id="500">Sitting Room</location> </device> - <device id="101"> <firmware>12.4(3d)</firmware> <location id="501">Class... (1 Reply)
Discussion started by: sureshcisco
1 Replies

4. Shell Programming and Scripting

Perl, open multiple files with wildcards

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)
Discussion started by: japaneseguitars
6 Replies

5. Shell Programming and Scripting

Perl script to extract second column from a xls

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)
Discussion started by: suvenduperl
2 Replies

6. Shell Programming and Scripting

Perl - grep issue in filenames with wildcards

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)
Discussion started by: guruprasadpr
5 Replies

7. Shell Programming and Scripting

Script to search and extract the gene sub-location from gff file.

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)
Discussion started by: reena2305
2 Replies

8. Shell Programming and Scripting

Search for a pattern,extract value(s) from next line, extract lines having those extracted value(s)

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)
Discussion started by: AshwaniSharma09
7 Replies

9. Shell Programming and Scripting

Perl script to extract a word from the file

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)
Discussion started by: jhamaks
7 Replies

10. Shell Programming and Scripting

Need to extract characters between two search words in a script!!

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
getdgrp(1M)						  System Administration Commands					       getdgrp(1M)

NAME
getdgrp - lists device groups which contain devices that match criteria SYNOPSIS
/usr/sbin/getdgrp [-ael] [criteria...] [dgroup...] DESCRIPTION
getdgrp generates a list of device groups that contain devices matching the given criteria. The criteria is given in the form of expres- sions. OPTIONS
The following options are supported: -a Specifies that a device must match all criteria to be included in the list generated by this command. The option has no effect if no criteria are defined. -e Specifies that the list of device groups on the command line should be excluded from the list generated by this command. Without the -e option the named device groups are included in the generated list. The flag has no effect if no devices are defined. -l Specifies that all device groups (subject to the -e option and the dgroup list) should be listed even if they contain no valid device members. This option has no affect if criteria is specified on the command line. OPERANDS
The following operands are supported: criteria Defines criteria that a device must match before a device group to which it belongs can be included in the generated list. Specify criteria as an expression or a list of expressions which a device must meet for its group to be included in the list generated by getdgrp. If no criteria are given, all device groups are included in the list. Devices must satisfy at least one of the criteria in the list. However, the -a option can be used to define that a "logi- cal and" operation should be performed. Then, only those groups containing devices which match all of the criteria in a list will be included. There are four possible expressions types which the criteria specified in the criteria argument may follow: attribute=value Selects all device groups with a member whose attribute attribute is defined and is equal to value. attribute!=value Selects all device groups with a member whose attribute attribute is defined and does not equal value. attribute:* Selects all device groups with a member which has the attribute attribute defined. attribute!:* Selects all device groups with a member which does not have the attribute attribute defined. See putdev(1M) for a complete listing and description of available attributes. dgroup Defines a set of device groups which should be included in or excluded from the generated list. Device groups that are defined and which contain devices matching the criteria are included. If the -e option is used, this list defines a set of device groups to be excluded. When the -e option is used and crite- ria is also defined, the generated list will include device groups containing devices which match the criteria and are not in the command line list. EXIT STATUS
The following exit values are returned: 0 Successful completion of the task. 1 Command syntax was incorrect, invalid option was used, or an internal error occurred. 2 Device table or device group table could not be opened for reading. FILES
/etc/device.tab /etc/dgroup.tab ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
devattr(1M), getdev(1M), putdev(1M), putdgrp(1M), attributes(5) SunOS 5.10 5 Jul 1990 getdgrp(1M)
All times are GMT -4. The time now is 11:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy