The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
perl parse line netxus Shell Programming and Scripting 2 08-24-2009 01:45 PM
Perl Parse Word Cksum help TeamUSA Shell Programming and Scripting 1 07-07-2009 05:47 AM
Perl parse string to time King Nothing Shell Programming and Scripting 1 05-19-2009 11:10 PM
CSV File parse help in Perl lodey Shell Programming and Scripting 13 03-31-2008 10:06 AM
How to parse a XML file using PERL and XML::DOm girigopal Shell Programming and Scripting 0 06-27-2005 07:46 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-25-2009
netxus netxus is offline
Registered User
  
 

Join Date: Aug 2009
Posts: 12
Perl Parse

Hi
I'm writing simple perl script to parse the ftp log as below:
Local directory now /home/user/testing
227 Entering Passive Mode (192,254,19,34,8,228).
125 Data connection already open; Transfer starting.
09-25-09 02:33PM 25333629 abc.tar
09-14-09 12:50PM 18015752 xyz.zip
09-14-09 12:50PM 7608056 test.zip
226 Transfer complete.
local: abc.tar remote: abc.tar
227 Entering Passive Mode (192,254,19,34,8,230).

my script below:-
#!/usr/bin/perl
$r=`/bin/cat ftplog`;
@lines=split(/\n/,$r);
foreach $line(@lines) {
if ($line =~ m/ abc.tar$/i) {
$remotefilesize=$line;
print"$remotefilesize\n";
}
}

output parse as below:=
09-25-09 02:33PM 25333629 abc.tar
local: abc.tar remote: abc.tar

QUESTION??
how do i get 25333629 abc.tar only 25333629

Thank for help or guide
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:22 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0