![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| nawk empty regular expression error | Rjkz | Shell Programming and Scripting | 6 | 12-21-2007 07:07 AM |
| error: initializer expression list treated as compound expression | arunchaudhary19 | High Level Programming | 12 | 11-16-2007 02: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 03:45 AM |
| Regular Expression + Aritmetical Expression | Z0mby | Shell Programming and Scripting | 2 | 05-21-2002 07:59 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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
|
| Forum Sponsor | ||
|
|
| Thread Tools | |
| Display Modes | |
|
|