Sponsored Content
Full Discussion: Quick question
Top Forums Shell Programming and Scripting Quick question Post 302289575 by summer_cherry on Friday 20th of February 2009 01:18:53 AM
Old 02-20-2009
Code:
#!/usr/bin/perl
use strict;
open FH,"<a.txt";
while(<FH>){
	print $1,"\n" if /^.*NAME.*NAME (.*) .*$/;
	print "No NAME\n" if !/^.*NAME.*NAME (.*) .*$/;
}
close FH;

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Quick Question

I know in DOS, when you want to pull up your last/previous command, you hit the up/down arrows. How do you do that with UNIX? (3 Replies)
Discussion started by: Tracy Hunt
3 Replies

2. Shell Programming and Scripting

A very quick question

Just a super quick question: how do you put a link in your php code. I want to make a link to something in /tmp directory. i.e. how do you put a href into php, I think it's done a bit differently. thanks john (1 Reply)
Discussion started by: jmg5
1 Replies

3. UNIX for Dummies Questions & Answers

Quick Question

Hello There! I am trying to write this SIMPLE script in Bourne Shell but I keep on getting syntax errors. Can you see what I am doing wrong? I've done this before but I don't see the difference. I am simply trying to take the day of the week from our system and when the teachers sign on I want... (7 Replies)
Discussion started by: catbad
7 Replies

4. UNIX for Dummies Questions & Answers

Another quick question

Hi guys sed -e "s/$<//g" the $< can allow me to assign an input value to the variable right? do the double quotes check the previous context? (1 Reply)
Discussion started by: hamoudzz
1 Replies

5. Shell Programming and Scripting

quick question

does anyone know what $? means? i echoed it on my box (running AIX Korn shell) and got 127 (2 Replies)
Discussion started by: penfold
2 Replies

6. UNIX for Dummies Questions & Answers

Quick Question

Hi, I am new to UNIX, and am learning from this tutorial : http://www.ee.surrey.ac.uk/Teaching/Unix/index.html It keeps telling me to files downloaded from the internet (like .txt files) to the directory, and I dont know how to. How do I add .txt files to my directory? Thanks. (6 Replies)
Discussion started by: IAMTHEEVILBEAN
6 Replies

7. UNIX for Dummies Questions & Answers

Quick question

Hi, Is there a simple way, using ksh, to find the byte position in a file that a stated character appears? Many thanks Helen (2 Replies)
Discussion started by: Bab00shka
2 Replies

8. UNIX for Dummies Questions & Answers

quick question

from command prompt I did grep two words on a same line for eg: grep abc | grep xyz and I got tht particular line, but I want to know when I vi that file how to directly search for that particular line? I appreciate if any one can provide answer, thanks in advance (2 Replies)
Discussion started by: pkolishetty
2 Replies

9. UNIX for Dummies Questions & Answers

Quick question

Hello all, Quick question from a fairly new to Unix developer. if then completedLogFile=$logfile.$(date +%Y%m%d-%H:%M:%S) mv $logfile $completedLogFile fi I understand that this portion of code is simply copying a tmp logfile to a completed logfile when a condition is true. The... (2 Replies)
Discussion started by: JohnnyBoy
2 Replies

10. UNIX for Dummies Questions & Answers

Quick question.

I'd like to list all userid's on the system that have a .bashrc file in their home directory with a command like "cat /etc/passwd | grep -f", however I'm not quite familiar with using grep. Any suggestions? (2 Replies)
Discussion started by: raidkridley
2 Replies
PMLOAD(1p)						User Contributed Perl Documentation						PMLOAD(1p)

NAME
pmload - show what files a given module loads at compile time DESCRIPTION
Given an argument of a module name, show all the files that are loaded directly or indirectly when the module is used at compile-time. EXAMPLES
$ pmload IO::Handle /usr/local/devperl/lib/5.00554/Exporter.pm /usr/local/devperl/lib/5.00554/Carp.pm /usr/local/devperl/lib/5.00554/strict.pm /usr/local/devperl/lib/5.00554/vars.pm /usr/local/devperl/lib/5.00554/i686-linux/DynaLoader.pm /usr/local/devperl/lib/5.00554/i686-linux/IO/Handle.pm /usr/local/devperl/lib/5.00554/Symbol.pm /usr/local/devperl/lib/5.00554/i686-linux/IO/File.pm /usr/local/devperl/lib/5.00554/SelectSaver.pm /usr/local/devperl/lib/5.00554/i686-linux/Fcntl.pm /usr/local/devperl/lib/5.00554/AutoLoader.pm /usr/local/devperl/lib/5.00554/i686-linux/IO.pm /usr/local/devperl/lib/5.00554/i686-linux/IO/Seekable.pm $ cat `pmload IO::Socket` | wc -l 4015 $ oldperl -S pmload Tk /usr/lib/perl5/site_perl/Tk/Pretty.pm /usr/lib/perl5/Symbol.pm /usr/lib/perl5/site_perl/Tk/Frame.pm /usr/lib/perl5/site_perl/Tk/Toplevel.pm /usr/lib/perl5/strict.pm /usr/lib/perl5/Exporter.pm /usr/lib/perl5/vars.pm /usr/lib/perl5/site_perl/auto/Tk/Wm/autosplit.ix /usr/lib/perl5/site_perl/auto/Tk/Widget/autosplit.ix /usr/lib/perl5/site_perl/Tk.pm /usr/lib/perl5/i386-linux/5.00404/DynaLoader.pm /usr/lib/perl5/site_perl/auto/Tk/Frame/autosplit.ix /usr/lib/perl5/site_perl/auto/Tk/Toplevel/autosplit.ix /usr/lib/perl5/Carp.pm /usr/lib/perl5/site_perl/auto/Tk/autosplit.ix /usr/lib/perl5/site_perl/Tk/CmdLine.pm /usr/lib/perl5/site_perl/Tk/MainWindow.pm /usr/lib/perl5/site_perl/Tk/Submethods.pm /usr/lib/perl5/site_perl/Tk/Configure.pm /usr/lib/perl5/AutoLoader.pm /usr/lib/perl5/site_perl/Tk/Derived.pm /usr/lib/perl5/site_perl/Tk/Image.pm /usr/lib/perl5/site_perl/Tk/Wm.pm /usr/lib/perl5/site_perl/Tk/Widget.pm NOTE
If the programmers used a delayed "require", those files won't show up. Furthermore, this doesn't show all possible files that get opened, just those that those up in %INC. Most systems have a way to trace system calls. You can use this to find the real answer. First, get a baseline with no modules loaded. $ strace perl -e 1 2>&1 | perl -nle '/^open("(.*?)".* = [^-]/ && print $1' /etc/ld.so.cache /lib/libnsl.so.1 /lib/libdb.so.2 /lib/libdl.so.2 /lib/libm.so.6 /lib/libc.so.6 /lib/libcrypt.so.1 /dev/null $ strace perl -e 1 2>&1 | grep -c '^open.*= [^-]' 8 Now add module loads and see what you get: $ strace perl -MIO::Socket -e 1 2>&1 | grep -c '^open.*= [^-]' 24 $ strace perl -MTk -e 1 2>&1 | grep -c '^open.*= [^-]' 35 SEE ALSO
Devel::Loaded, plxload(1). AUTHORS and COPYRIGHTS Copyright (C) 1999 Tom Christiansen. Copyright (C) 2006-2008 Mark Leighton Fisher. This is free software; you can redistribute it and/or modify it under the terms of either: (a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or (b) the Perl "Artistic License". (This is the Perl 5 licensing scheme.) Please note this is a change from the original pmtools-1.00 (still available on CPAN), as pmtools-1.00 were licensed only under the Perl "Artistic License". perl v5.10.1 2010-02-22 PMLOAD(1p)
All times are GMT -4. The time now is 08:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy