The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
awk gsub pxy2d1 Shell Programming and Scripting 4 08-22-2008 08:14 AM
How to apply sub/gsub of awk on a particular field? jaduks Shell Programming and Scripting 1 12-05-2007 05:16 AM
Help with AWK and gsub npolite Shell Programming and Scripting 4 11-15-2007 04:21 PM
use var in gsub of awk summer_cherry Shell Programming and Scripting 1 10-15-2007 05:01 AM
Gsub and nawk scotty_123 Shell Programming and Scripting 1 05-10-2007 11:10 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-06-2008
crosairs crosairs is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 4
Awk Gsub Query

Hi,

Can some one please explain the following line please throw some light on the ones marked in red

awk '{print $9}' ${FTP_LOG} | awk -v start=${START_DATE} 'BEGIN { FS = "." } { old_line1=$0; gsub(/\-/,""); if ( $3 >= start ) print old_line1 }' | awk -v end=${END_DATE} 'BEGIN { FS="." } { old_line2=$0; gsub(/\-/,""); if ( $3 <= end ) print old_line2 }' > ${FILES_TO_DOWNLOAD}


Thank you
  #2 (permalink)  
Old 10-06-2008
scorpio scorpio is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 41
Hi,

Put some echo statements inside the script for FTP_LOG ,START_DATE etc.. and for understanding run each command seperately (seperated by '|' )

It looks like printing the 9 th filed from FTP_LOG first and declaaring variables like START_DATE inside the awk, seperator is ' . '. and substtuting the values with gsub function.

And u didnt marked as red anywhere

Regards,
Scorpio
  #3 (permalink)  
Old 10-06-2008
crosairs crosairs is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 4
The gsub function is the part I couldnt understand,

Thanks
  #4 (permalink)  
Old 10-06-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
It removes all dash characters. (The backslash is redundant, but luckily harmless.)
Closed Thread

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 07:01 PM.


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