Sponsored Content
Top Forums Shell Programming and Scripting using perl to print columnwise Post 302339558 by summer_cherry on Thursday 30th of July 2009 10:35:23 PM
Old 07-30-2009
below should be ok, how to make up the hash with first file leave to youSmilie

Code:
my %hash=(2=>1,5=>1,7=>1,11=>1);
while(<DATA>){
	print if (exists $hash{$.});
}
__DATA__
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*
S*0.0197*0.0043*0.0037*0.0032*0.0018*0.0039*0.0015*0.0027*0.0030*0.0039*0.0012*0.2281*0.0025*0.0022* 0.0027*0.6511*0.0586*0.0040*0.0005*0.0016*0.3700*2.5000*
F*0.0029*0.0008*0.0021*0.0026*0.2621*0.0025*0.2339*0.0018*0.0023*0.0033*0.0010*0.0022*0.0017*0.0024* 0.0024*0.0028*0.0023*0.0023*0.4673*0.0015*0.4240*2.5000*
I*0.0046*0.0012*0.2219*0.0020*0.0069*0.0024*0.0055*0.1693*0.0020*0.2029*0.0021*0.0014*0.0019*0.0014* 0.0018*0.0025*0.0029*0.3649*0.0006*0.0018*0.5222*2.5000*
P*0.0515*0.0014*0.0849*0.0630*0.0027*0.2258*0.0282*0.0076*0.0126*0.0135*0.0016*0.0183*0.0637*0.0732* 0.0176*0.2021*0.0568*0.0655*0.0011*0.0091*0.7958*2.5000*
V*0.3128*0.0031*0.0190*0.0029*0.2206*0.0070*0.0015*0.1142*0.0109*0.0096*0.0028*0.0022*0.0083*0.0021* 0.0026*0.0205*0.0171*0.2189*0.0010*0.0231*0.6230*2.5000*
A*0.0941*0.0018*0.0247*0.0222*0.2207*0.0252*0.0084*0.0047*0.0062*0.0079*0.0020*0.2878*0.2066*0.0039* 0.0051*0.0547*0.0136*0.0061*0.0012*0.0032*0.6645*2.5000*
E*0.0993*0.0014*0.0975*0.3559*0.0030*0.0988*0.0057*0.0042*0.0914*0.0130*0.0021*0.0120*0.0475*0.0277* 0.0190*0.0762*0.0294*0.0119*0.0011*0.0027*0.7241*2.5000*
D*0.0790*0.0014*0.1773*0.0207*0.0025*0.0465*0.1021*0.0027*0.0151*0.0074*0.0015*0.1091*0.0950*0.0147* 0.0077*0.0723*0.2283*0.0040*0.0010*0.0117*0.7629*2.5000*
S*0.0337*0.0919*0.0055*0.0059*0.0034*0.0201*0.0194*0.0050*0.0055*0.0078*0.0023*0.0101*0.0589*0.0039* 0.2287*0.3931*0.0941*0.0069*0.0011*0.0029*0.6322*2.5000*
D*0.0074*0.0008*0.5185*0.0237*0.0015*0.0077*0.0809*0.0020*0.0038*0.0034*0.0009*0.0084*0.0960*0.0102* 0.0029*0.2229*0.0041*0.0027*0.0005*0.0015*0.5000*2.5000*
F*0.0029*0.0007*0.0021*0.0026*0.7291*0.0025*0.0019*0.0018*0.0022*0.0033*0.0010*0.0022*0.0017*0.0023* 0.2344*0.0028*0.0022*0.0022*0.0006*0.0014*0.2651*2.5000*
P*0.0090*0.0010*0.0049*0.0061*0.0025*0.0055*0.0019*0.0038*0.0054*0.2186*0.0015*0.0033*0.5570*0.0031* 0.0043*0.1334*0.0306*0.0053*0.0008*0.0021*0.4543*2.5000*
I*0.0037*0.0010*0.0017*0.0021*0.0042*0.0024*0.0009*0.4114*0.0021*0.3121*0.0034*0.0015*0.0018*0.0016* 0.0019*0.2273*0.0024*0.0117*0.0007*0.0063*0.4469*2.5000*
H*0.1051*0.0007*0.0031*0.2746*0.0014*0.0027*0.0798*0.0018*0.0120*0.0102*0.0010*0.0595*0.0019*0.4283* 0.0027*0.0031*0.0025*0.0024*0.0006*0.0063*0.5353*2.5000*

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

rearranging the data in file (from columnwise to rowwise)

Hi I have one file which is having data like 10201 10202 10205 10206 10207 10208 10209 10210 10211 10213 10215 10801 10802 11406 11415 11422 11426 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11530 11604 11608 11611 11717 11718 11719 11722 11725... (3 Replies)
Discussion started by: reldb
3 Replies

2. Shell Programming and Scripting

awk with paste ... columnwise

Hi, I'm trying to plot some data using the awk to find and parse the data and then use gnuplot to plot it up. I'd like to plot one or more range cells (let the user decide!). I've been able to write up the code such that I can plot one range cell per plot, but I just can't see how to get more... (1 Reply)
Discussion started by: dpath2o
1 Replies

3. Shell Programming and Scripting

Trying to print data row/columnwise

PRDCNT=12 FILS= f1=1 f2=2 f3=3 f4=4 f5=5 CNT=0 CNT=`expr $PRDCNT - 5` MNT=6 VR=1 while do f$VR="$f$VR,$MNT" echo "$f$VR" MNT=`expr $MNT + 1` CNT=`expr $CNT - 1` VR=`expr $VR + 1` if then (8 Replies)
Discussion started by: swaminathanks
8 Replies

4. Shell Programming and Scripting

Comparing files columnwise and print the differences in third file

Hello Everybody!!!!!!!!! Request you to help me with the below mentioned issue: I have 2 files say, File 1: a|4|7 b|3|2 c|8|8 d|8|9 File 2: a|4|6 b|2|2 c|8|8 d|9|8 The third file(output file) should have: Data mismatch in row 1 column 3 Data mismatch in row 2 coumn 2 Data... (3 Replies)
Discussion started by: abhijeet1409
3 Replies

5. Shell Programming and Scripting

Insert records in a file columnwise

Hello everyone!!!!! Need some help on inserting data in a file columnwise. Example: File1: 1|AAA|25|2 5|qqe|20|7 4|wer|31|81 I need to create a second file in which data can be inserted in a columnwise manner i.e. File2: AAA|25|1|2 qqe|20|5|7 wer|31|4|81 The order of columns in... (1 Reply)
Discussion started by: abhijeet1409
1 Replies

6. UNIX for Advanced & Expert Users

Insert records in a file columnwise

Hello everyone!!!!! Need some help on inserting data in a file columnwise. Example: File1: 1|AAA|25|2 5|qqe|20|7 4|wer|31|81 I need to create a second file in which data can be inserted in a columnwise manner i.e. File2: AAA|25|1|2 qqe|20|5|7 wer|31|4|81 The order of columns in... (1 Reply)
Discussion started by: abhijeet1409
1 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

Trim a file columnwise

Hi All, I want to trim each columns leading & trailing (like sql trim function) of a ',' separated file.. I've a file like this.. manab , c gi lucky , home babu , maa I want the output as manab,c gi lucky,home babu,maa A one liner would be a great help. (2 Replies)
Discussion started by: manab86
2 Replies

9. Shell Programming and Scripting

File comparison in UNIX columnwise

Hi all, I want to compare two files with same number of rows and columns with records in same order. Just want to highlight the differences in the column values if any. file A 1,kolkata,19,ab 2,delhi,89,cd 3,bangalore,56,ef file2: 1,kolkata,21,ab 2,mumbai,89,gh 3,bangalore,11,kl... (9 Replies)
Discussion started by: prabhat.diwaker
9 Replies

10. UNIX for Dummies Questions & Answers

Reading Xml file and print the values into the text file in columnwise?

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies
RP(4)							     Kernel Interfaces Manual							     RP(4)

NAME
rp - RP-11/RP03 moving-head disk DESCRIPTION
The files rp0 ... rp7 refer to sections of RP disk drive 0. The files rp8 ... rp15 refer to drive 1 etc. This allows a large disk to be broken up into more manageable pieces. The origin and size of the pseudo-disks on each drive are as follows: disk start length 0 0 81000 1 0 5000 2 5000 2000 3 7000 74000 4-7 unassigned Thus rp0 covers the whole drive, while rp1, rp2, rp3 can serve usefully as a root, swap, and mounted user file system respectively. The rp files access the disk via the system's normal buffering mechanism and may be read and written without regard to physical disk records. There is also a `raw' interface which provides for direct transmission between the disk and the user's read or write buffer. A single read or write call results in exactly one I/O operation and therefore raw I/O is considerably more efficient when many words are transmitted. The names of the raw RP files begin with rrp and end with a number which selects the same disk section as the corresponding rp file. In raw I/O the buffer must begin on a word boundary. FILES
/dev/rp?, /dev/rrp? SEE ALSO
hp(4) BUGS
In raw I/O read and write(2) truncate file offsets to 512-byte block boundaries, and write scribbles on the tail of incomplete blocks. Thus, in programs that are likely to access raw devices, read, write and lseek(2) should always deal in 512-byte multiples. RP(4)
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy