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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 11:16 AM
awk syntax error orahi001 UNIX for Dummies Questions & Answers 0 03-17-2008 09:35 AM
syntax error bkan77 Shell Programming and Scripting 2 07-30-2007 04:26 PM
I got error like...syntax error on line 1, teletype koti_rama UNIX for Advanced & Expert Users 2 07-07-2007 07:35 PM
awk syntax error yongho Shell Programming and Scripting 4 06-20-2005 10:03 AM

Closed Thread
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
  #1 (permalink)  
Old 06-14-2005
k@ssidy k@ssidy is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 31
awk syntax error

can anyone see the awk syntax error near line 1? I keep getting this error and I'm not familiar with awk very well yet so it is hard for me to see the errors.
fyi: deleteuser* refers to files in the directory where each one ends with a different date

ls -1 /mfupload/prod02/ftp/deleteuser* | while read line
do
cat $line | awk -F '|' {printf "%s|%\n", $5, $3} >> ftp.dat
done
  #2 (permalink)  
Old 06-14-2005
bhargav's Avatar
bhargav bhargav is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2004
Location: USA
Posts: 511
cat $line


replace it by


echo $line
  #3 (permalink)  
Old 06-14-2005
k@ssidy k@ssidy is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 31
why? I honestly don't know why echo is correct, please explain.
  #4 (permalink)  
Old 06-14-2005
k@ssidy k@ssidy is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 31
changing the single quotes to double did not fix the error, sorry
  #5 (permalink)  
Old 06-14-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
... i think you're missing the single quotes around the curly brackets ... see bold red ...
Code:
cat $line | awk -F "|" '{printf "%s|%\n", $5, $3}' >> ftp.dat
  #6 (permalink)  
Old 06-14-2005
k@ssidy k@ssidy is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 31
sorry, those single quotes didn't do the trick either.
  #7 (permalink)  
Old 06-14-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
instead of this ...
Code:
cat $line | awk -F '|' {printf "%s|%\n", $5, $3} >> ftp.dat
try this ...
Code:
cat $line | awk -F "|" '{printf "%s|%\n", $5, $3}' >> ftp.dat
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 12:38 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