Sponsored Content
Top Forums UNIX for Dummies Questions & Answers extracting selected few lines through perl Post 302215308 by vikas.nv on Wednesday 16th of July 2008 04:43:08 AM
Old 07-16-2008
There is an easy way out with perl too...

perl -ne 'print if $. >= 10; exit if $. >= 15;' filename1

Here $. is a special variable that represents current line number.

Regards,
Visit my PERL blog & subscribe for Email updates
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print selected lines

Hi everybody: I try to print in new file selected lines from another file wich depends on the first column. I have done a script like this: lines=( "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "21" "31" "41" "51" "55" "57" "58" ) ${lines} for lines in ${lines} do awk -v ... (6 Replies)
Discussion started by: tonet
6 Replies

2. Shell Programming and Scripting

Sum value from selected lines script (awk,perl)

Hello. I face this (2 side) problem. Some lines with this structure. ........... 12345678 4 12345989 13 12346356 205 12346644 74 12346819 22 ......... The first field (timestamp) is growing (or at least equal). 1)Sum the second fields if the first_field/500 are... (8 Replies)
Discussion started by: paolfili
8 Replies

3. UNIX for Dummies Questions & Answers

Copy selected lines in vim

Hi, I am looking to copy selected lines from a file using the vim editor. I have looked up a few resources and they have suggested to use this- Type mk Type: "ay'k (double quotes, <register name from a-z>, <y-yank single quote, k You can paste those lines wherever you want with "ap I tried... (7 Replies)
Discussion started by: coolavi
7 Replies

4. Shell Programming and Scripting

Process selected lines

I have an if statement where I state that if there are more than one records (lines) found containing a string in a file, then it enters into a while loop to use each line for as many lines as there are and then stop. Trouble is, I can't figure out how to move to the next instance of each line. ... (2 Replies)
Discussion started by: derekphl
2 Replies

5. UNIX for Dummies Questions & Answers

Extracting lines present in one file but missing in another using Perl

Hey I have an input file containing a list of numbers like: U01120.CDS.1 D25328.CDS.1 X15573.CDS.1 K03515.CDS.1 L44140.CDS.10 U24183.CDS.1 M97347.CDS.1 U05259.CDS.1 And another input file containing results created on the basis of the above input: G6PT_HUMAN U01120.CDS.1 -1.9450 3.1706... (1 Reply)
Discussion started by: Banni
1 Replies

6. Shell Programming and Scripting

trying to print selected fields of selected lines by AWK

I am trying to print 1st, 2nd, 13th and 14th fields of a file of line numbers from 29 to 10029. I dont know how to put this in one code. Currently I am removing the selected lines by awk 'NR==29,NR==10029' File1 > File2 and then doing awk '{print $1, $2, $13, $14}' File2 > File3 Can... (3 Replies)
Discussion started by: ananyob
3 Replies

7. Shell Programming and Scripting

finding least out of selected lines

Hello, I have a file, which looks like: I want to print the row containg "PRO" in second column after comparing and finding the minimum value of fifth column present in all "PRO". and likewise for every other string present in second column. I am using : filename=list... (2 Replies)
Discussion started by: CAch
2 Replies

8. Shell Programming and Scripting

AWK script - extracting min and max values from selected lines

Hi guys! I'm new to scripting and I need to write a script in awk. Here is example of file on which I'm working ATOM 4688 HG1 PRO A 322 18.080 59.680 137.020 1.00 0.00 ATOM 4689 HG2 PRO A 322 18.850 61.220 137.010 1.00 0.00 ATOM 4690 CD ... (18 Replies)
Discussion started by: grincz
18 Replies

9. Shell Programming and Scripting

Delete selected lines

hi Gurus, I have a source file with more than 10 columns ( not fixed ) I want to delete all the lines on the following condition 1) where i have first column as "UPDATE PLAN ADD RATE SCHEDULE" and fourth column as null awk '($1=="UPDATE PLAN ADD RATE SCHEDULE" && $4=="") {print $0}'... (5 Replies)
Discussion started by: r_t_1601
5 Replies

10. Shell Programming and Scripting

Selected matching lines

two files: one with the line number only, and the 2nd one with line number and content, as following: line_file.txt 1 3 5 9 23 30 content_file.txt 1|we are the world|good|great 2|easily do this by highlighting you|easily do this by highlighting you|easily do this by highlighting... (2 Replies)
Discussion started by: dtdt
2 Replies
Email::MessageID(3pm)					User Contributed Perl Documentation				     Email::MessageID(3pm)

NAME
Email::MessageID - Generate world unique message-ids. SYNOPSIS
use Email::MessageID; my $mid = Email::MessageID->new->in_brackets; print "Message-ID: $midx0Ax0D"; DESCRIPTION
Message-ids are optional, but highly recommended, headers that identify a message uniquely. This software generates a unique message-id. METHODS
new my $mid = Email::MessageID->new; my $new_mid = Email::MessageID->new( host => $myhost ); This class method constructs an Email::Address object containing a unique message-id. You may specify custom "host" and "user" parameters. By default, the "host" is generated from "Sys::Hostname::hostname". By default, the "user" is generated using "Time::HiRes"'s "gettimeofday" and the process ID. Using these values we have the ability to ensure world uniqueness down to a specific process running on a specific host, and the exact time down to six digits of microsecond precision. create_host my $domain_part = Email::MessageID->create_host; This method returns the domain part of the message-id. create_user my $local_part = Email::MessageID->create_user; This method returns a unique local part for the message-id. It includes some random data and some predictable data. in_brackets When using Email::MessageID directly to populate the "Message-ID" field, be sure to use "in_brackets" to get the string inside angle brackets: header => [ ... 'Message-Id' => Email::MessageID->new->in_brackets, ], Don't make this common mistake: header => [ ... 'Message-Id' => Email::MessageID->new->as_string, # WRONG! ], SEE ALSO
Email::Address, Time::HiRes, Sys::Hostname, perl. PERL EMAIL PROJECT
This module is maintained by the Perl Email Project. <http://emailproject.perl.org/wiki/Email::MessageID> AUTHOR
Casey West, <casey@geeknest.com>. COPYRIGHT
Copyright (c) 2004 Casey West. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-07-15 Email::MessageID(3pm)
All times are GMT -4. The time now is 11:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy