Perl : split flat line's to $


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl : split flat line's to $
# 8  
Old 07-21-2007
Thanks Madhan, Anbu & shellLife, it was helpful.. finally i used the below to get it right...

open(INFO, "$file") or die "an error occured: $!";
while (<INFO>) {
chomp;
my @lines = split(' ', $_, 3);
$NAME = $lines[0];
$REVISION = $lines[1];
$INFO = $lines[2];

we can limit the number of sections the string's will be split into, by passing a third argument. For example, we're splitting our data into 3 fields, though we have many more than 3 occurrances of the delimiter.

got the output as>

NParCmds
A.01.02
Enhanced NPartition Commands
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl split and add new line

Hi All, I find the below code printing the output of a particular field in same line, which i want it to be printed on a new line. ---CODE START--- foreach $defectRec (@outLs) { my($def_id,$status,$files_mod) = split(/,/, $defectRec); print "DEFECT ID: $def_id, Status:... (3 Replies)
Discussion started by: nmattam
3 Replies

2. Shell Programming and Scripting

Get line number in flat file

Hi, Is there a way to find out the line number from where the data starts? like if the data contains column header, irrespective of the text in the column header we should get the line number from which contains the column header. I am sorry if I haven't explained the problem clearly. ... (8 Replies)
Discussion started by: kedar_laveti
8 Replies

3. Shell Programming and Scripting

gnuplot flat line graph

Hi, I'm not able to find a solution because I cant find the exact keyword for this. I wanna make a graph like ive shown in the attachment. Could someone please share ideas on how to do this. Thanks! (3 Replies)
Discussion started by: jamie_123
3 Replies

4. Shell Programming and Scripting

perl: Read array from a flat file

Hello Guru's I want to read an array into a flatfile Please let me know how to do the same So far this the below code use strict; use warnings; open (my $data , '<', $ARGV)|| die "could not open $ARGV:\n$!"; my @array=(<$data>); my @sorted=sort... (8 Replies)
Discussion started by: Pratik4891
8 Replies

5. Shell Programming and Scripting

Sort flat file by 3rd column in perl

Hello Guys I want to sort a flat file by the third column (numeric ) and store it in some other name I/P 9924873|20111114|00000000000013013|130|13|10/15/2010 12:36:22|W860944|N|00 9924873|20111114|00000000000013009|130|09|10/15/2010 12:36:22|W860944|N|00... (12 Replies)
Discussion started by: Pratik4891
12 Replies

6. Shell Programming and Scripting

[Perl] Split lines into array - variable line items - variable no of lines.

Hi, I have the following lines that I would like to see in an array for easy comparisons and printing: Example 1: field1,field2,field3,field4,field5 value1,value2,value3,value4,value5Example 2: field1,field3,field4,field2,field5,field6,field7... (7 Replies)
Discussion started by: ejdv
7 Replies

7. Shell Programming and Scripting

Split positional flat file.

Hi, I need to split positional flat file, based on value at position 43-45.( in red "410") Example: 12345678907886421689 200920184820410200920020092002007 12345678907886421689 200920184820411200920020092002007 12345678907886421689 200920184820411200920020092002007... (6 Replies)
Discussion started by: meetmedude
6 Replies

8. Shell Programming and Scripting

Split a line on positions before reading complete line

Hi, I want to split before reading the complete line as the line is very big and its throwing out of memory. can you suggest. when i say #cat $inputFile | while read eachLine and use the eachLine to split its throwing out of memory as the line size is more than 10000000 characters. Can you... (1 Reply)
Discussion started by: vijaykrc
1 Replies

9. UNIX for Dummies Questions & Answers

how to remove the first line from a flat file ?

Hi, I want to remove the first line from a flat file using unix command as simple as possible. Can anybody give me a hand ? Thanks in advance. xli (21 Replies)
Discussion started by: xli
21 Replies

10. Shell Programming and Scripting

remove specific lines from flat file using perl

Hi, Here is wat im looking for.. i have a flat file which looks like this.. 00 * * * * .. .. * * text text text COL1 COL2 ----- ----- 1 a (12 Replies)
Discussion started by: meghana
12 Replies
Login or Register to Ask a Question
SHOWMOUNT(8)						    BSD System Manager's Manual 					      SHOWMOUNT(8)

NAME
showmount -- show remote nfs mounts on host SYNOPSIS
showmount [-a | -d] [-e] [-1] [-3] [host] DESCRIPTION
The showmount utility shows status information about the NFS server on host. By default it prints the names of all hosts that have NFS file systems mounted on the host. See NFS: Network File System Protocol Specification, RFC 1094, Appendix A, and NFS: Network File System Version 3 Protocol Specification, Appendix I, for a detailed description of the protocol. The following options are available: -a List all mount points in the form: host:dirpath. -d List directory paths of mount points instead of hosts. -e Show the host's exports list. -1 Use mount protocol Version 1, compatible with legacy servers. -3 Ignored for backwards compatibility. SEE ALSO
mount(8), mount_nfs(8), mountd(8) HISTORY
The showmount utility first appeared in 4.4BSD. BUGS
The mount daemon running on the server only has an idea of the actual mounts, since the NFS server is stateless. The showmount utility will only display the information as accurately as the mount daemon reports it. BSD
August 16, 2014 BSD