The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
nawk empty regular expression error Rjkz Shell Programming and Scripting 6 12-21-2007 08:07 AM
error: initializer expression list treated as compound expression arunchaudhary19 High Level Programming 12 11-16-2007 03:44 AM
regular expression..help!! andy2000 UNIX for Dummies Questions & Answers 1 07-25-2007 12:31 PM
regular expression help mac2118 Shell Programming and Scripting 5 03-01-2005 04:45 AM
Regular Expression + Aritmetical Expression Z0mby Shell Programming and Scripting 2 05-21-2002 07:59 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-16-2008
Registered User
 

Join Date: Nov 2005
Posts: 91
Regular Expression Error in AWK

I have a file "fwcsales_filenames.txt" which has a list of file names that are supposed to be copied to another directory. In addition to that, I am trying to extract the date part and write to the log.

I am getting the regular expression error when trying to strip the date part using the "ll" command. But I was able to count the number of records for each filename inside the list.

Please let me know what mistake I am doing here while usine AWK to print the date part.

Code:
while read FILENAME
do
  cp ${FTP}/$FILENAME ${EXPORT}/nz.$FILENAME
  if [ $? -eq 0 ]
    then
      let NUM_COPIED=`expr $NUM_COPIED+1`
     DAY=$(ll $FTP | awk '/$FILENAME/ {print $6 $7 substr($8,1,5)}' )
     echo "*** FTP file from $DAY "
     RECORDS=$(cat $FTP/$FILENAME |wc -l )
     echo '*** Number of $FILENAME records = ' $RECORDS
  fi
  done < ${FTP}/fwcsales_filenames.txt
HTML Code:
Output:
awk: There is a regular expression error.
        Invalid pattern.
 The input line number is 1.
 The source line number is 1.
*** FTP file from
*** Number of $FILENAME records =  256
Reply With Quote
Forum Sponsor
  #2  
Old 06-16-2008
Registered User
 

Join Date: Nov 2005
Posts: 91
Oooops...I found the answer....When I put quotes it worked...Sorry!!

Code:
DAY=$(ll $FTP/$FILENAME | awk '"$FILENAME" {print $6 $7 substr($8,1,5)}' )
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0