Index: engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java	(revision 3658)
+++ engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java	(working copy)
@@ -1469,7 +1469,7 @@
 			}
 		}
     	if (widthSet) {
-    		if (obj.getDelimiter() != null || obj.getHeader() != null || obj.getQuote() != null) {
+    		if (obj.getDelimiter() != null || obj.getHeader() != null || obj.getQuote() != null || obj.getSelector() != null) {
         		handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.text_table_width"), obj); //$NON-NLS-1$
     		}
     	} else {
Index: documentation/reference/src/main/docbook/en-US/content/grammar.xml
===================================================================
--- documentation/reference/src/main/docbook/en-US/content/grammar.xml	(revision 3658)
+++ documentation/reference/src/main/docbook/en-US/content/grammar.xml	(working copy)
@@ -24,8 +24,14 @@
 
 </para></entry></row>
 <row><entry><para>
+&lt;IN_MULTI_LINE_COMMENT&gt; MORE : {
+"/*" : {
+}
+
+</para></entry></row>
+<row><entry><para>
 &lt;IN_MULTI_LINE_COMMENT&gt; SPECIAL : {
-&lt;MULTI_LINE_COMMENT: "*/"&gt; : DEFAULT
+"*/" : {
 }
 
 </para></entry></row>
@@ -664,7 +670,7 @@
 <row>
 <entry align="right" valign="top"><para><anchor id="prod76" xreflabel="textTable"/>textTable</para></entry>
 <entry align="left" valign="top"><para>::= 
-&lt;ID&gt; &lt;LPAREN&gt; <link linkend="prod24">expression</link> <link linkend="prod11">nonReserved</link> <link linkend="prod82">textColumn</link> ( &lt;COMMA&gt; <link linkend="prod82">textColumn</link> )* ( &lt;NO&gt; &lt;ROW&gt; <link linkend="prod11">nonReserved</link> )? ( &lt;ID&gt; <link linkend="prod68">charVal</link> )? ( ( &lt;ESCAPE&gt; <link linkend="prod68">charVal</link> ) | ( &lt;ID&gt; <link linkend="prod68">charVal</link> ) )? ( &lt;ID&gt; ( <link linkend="prod83">intVal</link> )? )? ( &lt;ID&gt; <link linkend="prod83">intVal</link> )? &lt;RPAREN&gt; ( &lt;AS&gt; )? <link linkend="prod2">id</link></para></entry></row>
+&lt;ID&gt; &lt;LPAREN&gt; <link linkend="prod24">expression</link> <link linkend="prod11">nonReserved</link> <link linkend="prod82">textColumn</link> ( &lt;COMMA&gt; <link linkend="prod82">textColumn</link> )* ( &lt;NO&gt; &lt;ROW&gt; <link linkend="prod11">nonReserved</link> )? ( &lt;ID&gt; <link linkend="prod68">charVal</link> )? ( ( &lt;ESCAPE&gt; <link linkend="prod68">charVal</link> ) | ( &lt;ID&gt; <link linkend="prod68">charVal</link> ) )? ( &lt;ID&gt; ( <link linkend="prod83">intVal</link> )? )? ( &lt;ID&gt; <link linkend="prod83">intVal</link> )? ( &lt;ID&gt; <link linkend="prod1">stringVal</link> )? &lt;RPAREN&gt; ( &lt;AS&gt; )? <link linkend="prod2">id</link></para></entry></row>
 <row>
 <entry align="right" valign="top"><para><anchor id="prod82" xreflabel="textColumn"/>textColumn</para></entry>
 <entry align="left" valign="top"><para>::= 
@@ -844,7 +850,7 @@
 <row>
 <entry align="right" valign="top"><para><anchor id="prod112" xreflabel="function"/>function</para></entry>
 <entry align="left" valign="top"><para>::= 
-( ( &lt;CONVERT&gt; &lt;LPAREN&gt; <link linkend="prod24">expression</link> &lt;COMMA&gt; <link linkend="prod37">dataType</link> &lt;RPAREN&gt; ) | ( &lt;CAST&gt; &lt;LPAREN&gt; <link linkend="prod24">expression</link> &lt;AS&gt; <link linkend="prod37">dataType</link> &lt;RPAREN&gt; ) | ( <link linkend="prod11">nonReserved</link> &lt;LPAREN&gt; <link linkend="prod24">expression</link> &lt;FROM&gt; <link linkend="prod24">expression</link> ( &lt;FOR&gt; <link linkend="prod24">expression</link> )? &lt;RPAREN&gt; ) | ( <link linkend="prod11">nonReserved</link> &lt;LPAREN&gt; ( &lt;YEAR&gt; | &lt;MONTH&gt; | &lt;DAY&gt; | &lt;HOUR&gt; | &lt;MINUTE&gt; | &lt;SECOND&gt; ) &lt;FROM&gt; <link linkend="prod24">expression</link> &lt;RPAREN&gt; ) | ( <link linkend="prod11">nonReserved</link> &lt;LPAREN&gt; ( ( ( ( &lt;LEADING&gt; | &lt;TRAILING&gt; | &lt;BOTH&gt; ) ( <link linkend="prod24">expression</link> )? ) | <link linkend="prod24">expression</link> ) &lt;FROM&gt; )? <link linkend="prod24">expression</link> &lt;RPAREN&gt; ) | ( <link linkend="prod11">nonReserved</link> &lt;LPAREN&gt; <link linkend="prod24">expression</link> &lt;COMMA&gt; <link linkend="prod116">stringConstant</link> &lt;RPAREN&gt; ) | ( <link linkend="prod11">nonReserved</link> &lt;LPAREN&gt; <link linkend="prod117">intervalType</link> &lt;COMMA&gt; <link linkend="prod24">expression</link> &lt;COMMA&gt; <link linkend="prod24">expression</link> &lt;RPAREN&gt; ) | <link linkend="prod118">queryString</link> | ( ( &lt;LEFT&gt; | &lt;RIGHT&gt; | &lt;CHAR&gt; | &lt;USER&gt; | &lt;YEAR&gt; | &lt;MONTH&gt; | &lt;HOUR&gt; | &lt;MINUTE&gt; | &lt;SECOND&gt; | &lt;XMLCONCAT&gt; | &lt;XMLCOMMENT&gt; ) &lt;LPAREN&gt; ( <link linkend="prod47">expressionList</link> )? &lt;RPAREN&gt; ) | ( ( &lt;TRANSLATE&gt; | &lt;INSERT&gt; ) &lt;LPAREN&gt; ( <link linkend="prod47">expressionList</link> )? &lt;RPAREN&gt; ) | <link linkend="prod119">xmlParse</link> | <link linkend="prod120">xmlElement</link> | ( &lt;XMLPI&gt; &lt;LPAREN&gt; ( &lt;ID&gt; <link linkend="prod121">idExpression</link> | <link linkend="prod121">idExpression</link> ) ( &lt;COMMA&gt; <link linkend="prod24">expression</link> )? &lt;RPAREN&gt; ) | <link linkend="prod122">xmlForest</link> | <link linkend="prod81">xmlSerialize</link> | <link linkend="prod84">xmlQuery</link> | ( <link linkend="prod2">id</link> &lt;LPAREN&gt; ( <link linkend="prod47">expressionList</link> )? &lt;RPAREN&gt; ) )</para></entry></row>
+( ( &lt;CONVERT&gt; &lt;LPAREN&gt; <link linkend="prod24">expression</link> &lt;COMMA&gt; <link linkend="prod37">dataType</link> &lt;RPAREN&gt; ) | ( &lt;CAST&gt; &lt;LPAREN&gt; <link linkend="prod24">expression</link> &lt;AS&gt; <link linkend="prod37">dataType</link> &lt;RPAREN&gt; ) | ( <link linkend="prod11">nonReserved</link> &lt;LPAREN&gt; <link linkend="prod24">expression</link> ( ( &lt;FROM&gt; <link linkend="prod24">expression</link> ( &lt;FOR&gt; <link linkend="prod24">expression</link> )? ) | ( &lt;COMMA&gt; <link linkend="prod47">expressionList</link> ) ) &lt;RPAREN&gt; ) | ( <link linkend="prod11">nonReserved</link> &lt;LPAREN&gt; ( &lt;YEAR&gt; | &lt;MONTH&gt; | &lt;DAY&gt; | &lt;HOUR&gt; | &lt;MINUTE&gt; | &lt;SECOND&gt; ) &lt;FROM&gt; <link linkend="prod24">expression</link> &lt;RPAREN&gt; ) | ( <link linkend="prod11">nonReserved</link> &lt;LPAREN&gt; ( ( ( ( &lt;LEADING&gt; | &lt;TRAILING&gt; | &lt;BOTH&gt; ) ( <link linkend="prod24">expression</link> )? ) | <link linkend="prod24">expression</link> ) &lt;FROM&gt; )? <link linkend="prod24">expression</link> &lt;RPAREN&gt; ) | ( <link linkend="prod11">nonReserved</link> &lt;LPAREN&gt; <link linkend="prod24">expression</link> &lt;COMMA&gt; <link linkend="prod116">stringConstant</link> &lt;RPAREN&gt; ) | ( <link linkend="prod11">nonReserved</link> &lt;LPAREN&gt; <link linkend="prod117">intervalType</link> &lt;COMMA&gt; <link linkend="prod24">expression</link> &lt;COMMA&gt; <link linkend="prod24">expression</link> &lt;RPAREN&gt; ) | <link linkend="prod118">queryString</link> | ( ( &lt;LEFT&gt; | &lt;RIGHT&gt; | &lt;CHAR&gt; | &lt;USER&gt; | &lt;YEAR&gt; | &lt;MONTH&gt; | &lt;HOUR&gt; | &lt;MINUTE&gt; | &lt;SECOND&gt; | &lt;XMLCONCAT&gt; | &lt;XMLCOMMENT&gt; ) &lt;LPAREN&gt; ( <link linkend="prod47">expressionList</link> )? &lt;RPAREN&gt; ) | ( ( &lt;TRANSLATE&gt; | &lt;INSERT&gt; ) &lt;LPAREN&gt; ( <link linkend="prod47">expressionList</link> )? &lt;RPAREN&gt; ) | <link linkend="prod119">xmlParse</link> | <link linkend="prod120">xmlElement</link> | ( &lt;XMLPI&gt; &lt;LPAREN&gt; ( &lt;ID&gt; <link linkend="prod121">idExpression</link> | <link linkend="prod121">idExpression</link> ) ( &lt;COMMA&gt; <link linkend="prod24">expression</link> )? &lt;RPAREN&gt; ) | <link linkend="prod122">xmlForest</link> | <link linkend="prod81">xmlSerialize</link> | <link linkend="prod84">xmlQuery</link> | ( <link linkend="prod2">id</link> &lt;LPAREN&gt; ( <link linkend="prod47">expressionList</link> )? &lt;RPAREN&gt; ) )</para></entry></row>
 <row>
 <entry align="right" valign="top"><para><anchor id="prod116" xreflabel="stringConstant"/>stringConstant</para></entry>
 <entry align="left" valign="top"><para>::= 
Index: api/src/main/java/org/teiid/language/SQLConstants.java
===================================================================
--- api/src/main/java/org/teiid/language/SQLConstants.java	(revision 3658)
+++ api/src/main/java/org/teiid/language/SQLConstants.java	(working copy)
@@ -73,6 +73,8 @@
 		public static final String HEADER = "HEADER"; //$NON-NLS-1$
 		public static final String QUOTE = "QUOTE"; //$NON-NLS-1$
 		public static final String COLUMNS = "COLUMNS"; //$NON-NLS-1$
+		public static final String SELECTOR = "SELECTOR"; //$NON-NLS-1$
+		public static final String SKIP = "SKIP"; //$NON-NLS-1$
 		//xmltable
 		public static final String ORDINALITY = "ORDINALITY"; //$NON-NLS-1$
 		public static final String PASSING = "PASSING"; //$NON-NLS-1$
@@ -113,7 +115,7 @@
 		public static final String ENABLED = "ENABLED"; //$NON-NLS-1$
 		public static final String DISABLED = "DISABLED"; //$NON-NLS-1$
 		
-		public static final String TRIM = "TRIM";
+		public static final String TRIM = "TRIM"; //$NON-NLS-1$
 	}
 	
 	public interface Reserved {
Index: engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj	(revision 3658)
+++ engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj	(working copy)
@@ -2320,6 +2320,7 @@
 	Character quote = null;
 	Integer header = null;
 	Integer skip = null;
+	String selector = null;
 	String aliasID = null;
 }
 {
@@ -2366,6 +2367,10 @@
 	  LOOKAHEAD(<ID>, { "skip".equalsIgnoreCase(getToken(1).image) }) <ID>
 	  skip = intVal()
 	]
+	[
+	  LOOKAHEAD(<ID>, { "selector".equalsIgnoreCase(getToken(1).image) }) <ID>
+	  selector = stringVal()
+	]
  	<RPAREN>
  	[<AS>] aliasID=id()
  	{
@@ -2379,6 +2384,7 @@
  		result.setName(validateAlias(aliasID));
  		result.setQuote(quote);
  		result.setUsingRowDelimiter(useRowDelimiter);
+ 		result.setSelector(selector);
  		return result;
  	}
 }
Index: engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
===================================================================
--- engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java	(revision 3658)
+++ engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java	(working copy)
@@ -170,6 +170,10 @@
 				break;
 			}
 			
+			if (table.getSelector() != null && !line.startsWith(table.getSelector())) {
+				continue;
+			}
+			
 			List<String> vals = parseLine(line);
 			
 			List<Object> tuple = new ArrayList<Object>(projectionIndexes.length);
Index: engine/src/test/java/org/teiid/query/processor/TestTextTable.java
===================================================================
--- engine/src/test/java/org/teiid/query/processor/TestTextTable.java	(revision 3658)
+++ engine/src/test/java/org/teiid/query/processor/TestTextTable.java	(working copy)
@@ -314,7 +314,17 @@
         sampleData1(dataManager);
         RelationalPlan plan = (RelationalPlan)helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached());
         helpProcess(plan, createCommandContext(), dataManager, expected);
-    } 
+    }
+	
+	@Test public void testTextTableSelector() throws Exception {
+		String sql = "select x.* from (select * from pm1.g1) y, texttable(e1 || '\n' || e2 || '\n' || e3 COLUMNS x string SELECTOR 'c') x";
+    	
+        List[] expected = new List[] {
+        		Arrays.asList("c"),
+        };    
+
+        process(sql, expected);
+    }
 	
 	public static void process(String sql, List[] expectedResults) throws Exception {    
     	FakeDataManager dataManager = new FakeDataManager();
Index: engine/src/main/java/org/teiid/query/sql/lang/TextTable.java
===================================================================
--- engine/src/main/java/org/teiid/query/sql/lang/TextTable.java	(revision 3658)
+++ engine/src/main/java/org/teiid/query/sql/lang/TextTable.java	(working copy)
@@ -95,9 +95,18 @@
     private Integer header;
     private Integer skip;
     private boolean usingRowDelimiter = true;
+    private String selector;
     
     private boolean fixedWidth;
     
+    public String getSelector() {
+		return selector;
+	}
+    
+    public void setSelector(String selector) {
+		this.selector = selector;
+	}
+    
     public Character getQuote() {
 		return quote;
 	}
Index: engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
--- engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java	(revision 3658)
+++ engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java	(working copy)
@@ -1906,10 +1906,16 @@
         }
         if (obj.getSkip() != null) {
             append(SPACE);
-            append("SKIP"); //$NON-NLS-1$
+            append(NonReserved.SKIP);
             append(SPACE);
             append(obj.getSkip());
         }
+        if (obj.getSelector() != null) {
+        	append(SPACE);
+        	append(NonReserved.SELECTOR);
+        	append(SPACE);
+        	append(escapeSinglePart(obj.getSelector()));
+        }
         append(")");//$NON-NLS-1$
         append(SPACE);
         append(AS);
Index: engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- engine/src/main/resources/org/teiid/query/i18n.properties	(revision 3658)
+++ engine/src/main/resources/org/teiid/query/i18n.properties	(working copy)
@@ -714,7 +714,7 @@
 ValidationVisitor.drop_of_nontemptable=Cannot drop a non temporary table "{0}".							
 ValidationVisitor.orderby_expression_xml=XML queries cannot order by an expression.
 ValidationVisitor.text_table_invalid_width=For a fixed width text table, all columns must have width set.
-ValidationVisitor.text_table_width=Fixed width text tables should not have DELIMITER, QUOTE, ESCAPE, or HEADER specified.
+ValidationVisitor.text_table_width=Fixed width text tables should not have DELIMITER, QUOTE, ESCAPE, SELECTOR or HEADER specified.
 ValidationVisitor.text_table_negative=Text table WIDTH, HEADER, or SKIP values must not be negative. 
 ValidationVisitor.text_table_delimiter=Text DELIMITER cannot be the same as the QUOTE or ESCAPE characters.
 ValidationVisitor.text_table_newline=Text DELIMITER, QUOTE, and ESCAPE characters cannot be the new line character.
