Visit Our UNIX and Linux User Community

Top Forums Shell Programming and Scripting perl with two files and print Post 302337961 by cdfd123 on Sunday 26th of July 2009 01:27:43 PM
Old 07-26-2009
Java perl with two files and print

Suppose u have two files

one file
>hi|23433|sp|he is RAJ<space>>hi|23333|df|He is HUMAN<space>>hi|222|gi|howru|just
>hi|25559|gs|heisANUJ<space>>hi|2232|sp|he is fool

Another file

so output wil be ...if the list contain HUMAN only take it as shown:
HUMAN hi|23433|sp|he is RAJ

#! /usr/bin/perl -w

open(FILE,"$ARGV[0]") or die;
my @temp=<FILE>;
close FILE;

my $f=join("",@temp);
my @reco=split("ronaldo",$f);
my $dis=shift(@reco);
pen(FILE,"$ARGV[1]") or die;
my @temp1=<FILE>;
close FILE;

if($reco =~ /$temp1/)
print "YES";
else {
print "NO??????\n\n";

it is not gud perlscript only it will print either YES or NO
Whta can be possible solution

Last edited by cdfd123; 07-26-2009 at 03:29 PM.. Reason: coloring the space
Test Your Knowledge in Computers #410
Difficulty: Easy
Trusted XENIX was a variant initially developed by HP-UX, under the name Secure XENIX.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PERL: print if files present

FOR: Windows NT 4 I want perl to read a directory. there is suposed to be two files in the folder ( file1.ini and file2.ini ) and i want perl to print "Files present" or "Files NOT present" to a text document ( report.txt ) how do i do it.? (2 Replies)
Discussion started by: perleo
2 Replies

2. UNIX for Dummies Questions & Answers

perl print command

Hi, I am running this command in perl print "this is a test message @1.00 pm\n" but the output i am getting as this is a test message .00 pm pls help, how to get the proper output (2 Replies)
Discussion started by: vasikaran
2 Replies

3. Shell Programming and Scripting

Perl: Search and print help

Hi all, I need a bit of help with a perl script, I have a file containing lines that look like: M1 (Agnd Agnd ibias_gnP Agnd) nch l=250.0n w=10u m=1 ad=2.5e-12 \ as=2.5e-12 pd=20.5u ps=20.5u nrd=0.025 nrs=0.025 sa=2.5e-07 \ sb=2.5e-07 M21 (Agnd VSSabc Agnd Agnd) nch... (3 Replies)
Discussion started by: Crypto
3 Replies

4. Shell Programming and Scripting

using perl to print 1 or 0

Suppose u have a file FILE A ABCA10 DIFF VALUES P203S POLY ABCA1 DIFF VALUES A1046D ABCA4 DIFF VALUES D846H POLY ABCA4 DIFF VALUES I1846T POLY ABCA4 DIFF VALUES Wa ABCA4 DIFF VALUES WA ABCA4 DIFF VALUES Wb and u want to print that if FILE A have POLY so print 0 otherwise 1 means... (1 Reply)
Discussion started by: cdfd123
1 Replies

5. Shell Programming and Scripting

using perl to print columnwise

Suppose we have two files one file FAAA_HUMAN.input1 2 5 7 11 and another file FAAA_HUMAN.output M*0.0540*0.0039*0.2212*0.0082*0.0020*0.0137*0.0028*0.0029*0.2198*0.0104*0.0889*0.0282*0.0049*0.0804*0.1743*0.0215*0.0531*0.0071*0.0007*0.0021*0.7270*2.5000*... (4 Replies)
Discussion started by: cdfd123
4 Replies

6. Shell Programming and Scripting

awk -F'|' '{ print $5 }' in perl

Hi guys i need you help its urgent.. im trying to translate this file processing command in Perl. awk -F'|' '{ print $5 }' any ideas ;) Regards (6 Replies)
Discussion started by: raid5
6 Replies

7. Shell Programming and Scripting

Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time.

How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ? Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 Replies

8. Shell Programming and Scripting

Perl print between 2 patterns

I have been unable to find this anywhere; I have a multiline variable, and I want to print the text between two patterns in that variable. So the variable is My real name is not DeadmanAnd I need the output to be this, by printing between "real" and "not" name is or including the two... (10 Replies)
Discussion started by: killer54291
10 Replies

9. Shell Programming and Scripting

color print using perl

Hi i want to print the text in different color using perl script. i am able to print on console(terminal). but if i try to print the same into a file, i am not able to do #!/bin/usr/perl use Term::ANSIColor; print "This text is normal.\n"; use Term::ANSIColor qw(:constants);... (3 Replies)
Discussion started by: roopa
3 Replies

10. Shell Programming and Scripting

Print the name of files in the directory using Perl

Hi All, I am stuck with a problem and i want your help, what i want to do is I have a directory name dircome and there are 6 files present in this directory, the name of the files are d1,d2,d3,d4,d5,d6. The Perl script print the files name, means the output should be d1 d2 d3 d4 d5 d6 (9 Replies)
Discussion started by: parthmittal2007
9 Replies
GRUB-MKRESCUE(1)						   User Commands						  GRUB-MKRESCUE(1)

grub-mkrescue - make a GRUB rescue image SYNOPSIS
Make GRUB CD-ROM, disk, pendrive and floppy bootable image. --compress=no|xz|gz|lzo compress GRUB files [optional] -d, --directory=DIR use images and modules under DIR [default=/usr/lib/grub/<platform>] --fonts=FONTS install FONTS [default=unicode] --install-modules=MODULES install only MODULES and their dependencies [default=all] -k, --pubkey=FILE embed FILE as public key for signature checking --locale-directory=DIR use translations under DIR [default=/usr/share/locale] --locales=LOCALES install only LOCALES [default=all] --modules=MODULES pre-load specified modules MODULES --themes=THEMES install THEMES [default=starfield] -v, --verbose print verbose messages. --arcs-boot enable ARCS (big-endian mips machines, mostly SGI) boot. Disables HFS+, APM, sparc64 and boot as disk image for i386-pc --core-compress=xz|none|auto choose the compression to use for core image --label-bgcolor=COLOR use COLOR for label background --label-color=COLOR use COLOR for label --label-font=FILE use FILE as font for label -o, --output=FILE save output in FILE [required] --product-name=STRING use STRING as product name --product-version=STRING use STRING as product version --rom-directory=DIR save ROM images in DIR [optional] --sparc-boot enable sparc boot. Disables HFS+, APM, ARCS and boot as disk image for i386-pc --xorriso=FILE use FILE as xorriso [optional] -?, --help give this help list --usage give a short usage message -V, --version print program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. Generates a bootable CD/USB/floppy image. Arguments other than options to this program are passed to xorriso, and indicate source files, source directories, or any of the mkisofs options listed by the output of `xorriso -as mkisofs -help'. Option -- switches to native xorriso command mode. Mail xorriso support requests to <>. REPORTING BUGS
Report bugs to <>. SEE ALSO
grub-mkimage(1) The full documentation for grub-mkrescue is maintained as a Texinfo manual. If the info and grub-mkrescue programs are properly installed at your site, the command info grub-mkrescue should give you access to the complete manual. grub-mkrescue (GRUB) 2.02-2ubuntu8.3 July 2018 GRUB-MKRESCUE(1)

Featured Tech Videos

All times are GMT -4. The time now is 06:36 AM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy