Thoughts From My Life
Sep
24

Awk - Error - Unterminated String

Written by Neil Galloway
 

I was frustrated using awk recently. I had created a awk file to do some batch processing of text file information. Anyhow, I had a large text section to create an SQL statement from. It spanned multiple lines and I had used a backslash "\" to indicate the string continued on the next line.

I had a syntax problem however. It was saying I had an unterminated string. I googled for the answer and checked to make sure every line of my text section had a backslash (which it did) and I couldn't figure it out.

Below is the error I had.

awk: query.awk:2: print "SELECT \
awk: query.awk:2:       ^ unterminated string

Anyhow, last straw was to go to everyline that had the backslash at the end and remove any spaces at that came after the backslash (so between the slash and the true end of the line). This fixed my problem.

If you enjoyed this post, then make sure you subscribe to my RSS feed or subscribe for email updates. Only one email a day and only if there was a new post.



Related Posts

Create Your Own Search Engine With MySQL
Finding Music Files Using Google
iTunes has detected an iPod in recovery mode - Use iTunes to restore
Replacing The Tailpiece On My Mandolin
Redirect Your RSS Feed To FeedBurner

Email this article

Category: Computers

Original Post: Friday, September 24th, 2010


0 Comments

No approved comments yet.

Add a Comment

Note: Comments will be visible after they have been moderated.
Name:

Email: (Never made public)

Web Page:
(include http:// or https://)
Comment:


Enter Verification (image below):