Command line grep gives wrong results - grep

I have two files, one with the patterns of a grep search, and the other is the target file where I want to look for patterns.
File 1 looks like this:
Cre01.g001800
Cre01.g001950
g46
g46
Cre01.g002050
Cre01.g002150
RPB6
g51
Cre01.g002201
Cre01.g002201
Cre01.g002236
Cre01.g002236
Cre01.g002300
And my second file looks like this:
chromosome_12 scriptAPG exon 3691112 3693536 . + . gene_id "RPS11";transcript_id "RPS11"
chromosome_9 scriptAPG exon 3011840 3038275 . - . gene_id "Cre09.g387400";transcript_id "Cre09.g387400"
chromosome_9 scriptAPG exon 2571100 2572801 . + . gene_id "Cre09.g390678";transcript_id "Cre09.g390678"
chromosome_14 scriptAPG exon 3804470 3817534 . + . gene_id "Cre14.g632650";transcript_id "Cre14.g632650"
chromosome_3 scriptAPG exon 4400340 4417459 . + . gene_id "Cre03.g175600";transcript_id "Cre03.g175600"
scaffold_40 scriptAPG exon 36 2671 . + . gene_id "g18380";transcript_id "g18380"
chromosome_6 scriptAPG exon 7445801 7457337 . - . gene_id "Cre06.g300050";transcript_id "Cre06.g300050"
chromosome_17 scriptAPG exon 584317 595135 . + . gene_id "Cre17.g699950";transcript_id "Cre17.g699950"
My aim is to extract the rows in file2 that have some pattern in file1. So, I throw the following command:
grep -w -F -f ".$out."/localization/prep/translator.txt localization/prep/locations.gtf > localization/prep/genemodels.gtf
What I am not understanding is: why the output file from the grep search, genemodels.gtf, have lines without matching patterns? It prints all the lines!! Doing this:
grep Cre01.g003600 translator.txt
I do not obtain any results. However, doing this:
grep Cre01.g003600 genemodels.gtf
I obtain:
chromosome_1 scriptAPG exon 688996 690516 . + . gene_id "Cre01.g003600";transcript_id "Cre01.g003600"
Do you know what I am doing wrong? Could it be the point . that some patterns to look for (e. g. Cre01.g001950) have? Grep does not sees that as a literal point. How to avoid that?
Thanks.

Related

Find specific words after a match

I have a dataset that looks something like this:
chr1 StringTie exon 197757319 197757401 1000 + . gene_id "MSTRG.10429"; transcript_id "ENST00000440885.1"; exon_number "1"; gene_name "RP11-448G4.4"; ref_gene_id "ENSG00000224901.1";
chr1 StringTie exon 197761802 197761965 1000 + . gene_id "MSTRG.10429"; transcript_id "ENST00000440885.1"; exon_number "2"; gene_name "RP11-448G4.4"; ref_gene_id "ENSG00000224901.1";
chr9 StringTie exon 63396911 63397070 1000 - . gene_id "MSTRG.145111"; transcript_id "MSTRG.145111.1"; exon_number "1";
chr9 StringTie exon 63397111 63397185 1000 - . gene_id "MSTRG.145111"; transcript_id "MSTRG.145111.1"; exon_number "2";
chr21 StringTie exon 44884690 44884759 1000 + . gene_id "MSTRG.87407"; transcript_id "MSTRG.87407.1"; exon_number "1";
chr22 HAVANA exon 19667023 19667199 . + . gene_id "ENSG00000225007.1"; transcript_id "ENST00000452326.1"; exon_number "1"; gene_name "AC000067.1";
chr22 HAVANA exon 19667446 19667555 . + . gene_id "ENSG00000225007.1"; transcript_id "ENST00000452326.1"; exon_number "2"; gene_name "AC000067.1";
I want to isolate the gene_ids. Therefore, the desired output is:
MSTRG.10429
MSTRG.10429
MSTRG.145111
MSTRG.145111
MSTRG.87407
ENSG00000225007.1
ENSG00000225007.1
I've tried the following:
grep -E -o "gene_id.{0,20}" gtf_om_ENSGids_te_vinden.gtf > alle_gene_ids.txt
With this I can grep the 20 characters after "gene_id" and I wanted to later remove the other characters which do not belong to the answer such as parts of the word "transcript". However, a problem is that the ref_gene_ids also get copied, which does not belong to the desired output. I tried to solve this by adding the -w flag, but this is also wrong for some reason. Can anyone help?
Thanks!
GNU grep, using the perl regex flag:
grep -Po '(?<=\Wgene_id ")[^"]+'
POSIX sed:
sed -En 's/.*[^[:alnum:]_]gene_id "([^"]+).*/\1/p'
If there are multiple occurrences per line, the grep will print all of them, but the sed will print the last occurrence only.
Use:
grep -o -E ' gene_id \"([^"]*)\"' gtf_om_ENSGids_te_vinden.gtf | sed -E 's/gene_id|"| //g'
the space in ' gene_id is needed to make sure the ref_gene_id is not matched.
The sed part will remove gene_id, the space, and the double quotes.
see: https://regex101.com/r/TDA7Cg/1
EDIT: Because of the tab, which is not a space:
Change it to
grep -o -E '[ \t]gene_id \"([^"]*)\"' gtf_om_ENSGids_te_vinden.gtf | sed -E 's/gene_id|"| //g'
or to just find the start of the word you could to
grep -o -E '\Wgene_id \"([^"]*)\"' gtf_om_ENSGids_te_vinden.gtf | sed -E 's/gene_id|"| //g'
But still the accepted answer is a nicer way to do it ... 😉

Error in reloading taglib classes in grails 2.5.2

I am using grails 2.5.2 and working on a taglib. When I execute grails run-app everything runs fine, but whenever I make a change in my taglib and save the file I get the following error
Error |
2016-02-26 16:29:30,628 [Thread-9] ERROR plugins.AbstractGrailsPluginManager - Plugin [groovyPages:2.5.2] could not reload changes to file [D:\...\BootstrapTagLib.groovy]: Ambiguous method overloading for method grails.spring.BeanBuilder#registerBeans.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[interface org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfiguration]
[interface org.springframework.beans.factory.support.BeanDefinitionRegistry]
Message: Ambiguous method overloading for method grails.spring.BeanBuilder#registerBeans.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[interface org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfiguration]
[interface org.springframework.beans.factory.support.BeanDefinitionRegistry]
Line | Method
->> 3241 | chooseMostSpecificParams in groovy.lang.MetaClassImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 3194 | chooseMethodInternal in ''
| 3137 | chooseMethod . . . . . . . . in ''
| 1328 | getMethodWithCachingInternal in ''
| 3405 | createPogoCallSite . . . . . in ''
| 1314 | createPogoCallSite in groovy.lang.ExpandoMetaClass
| 150 | createPogoSite . . . . . . . in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 164 | createCallSite in ''
| 48 | defaultCall . . . . . . . . in ''
| 113 | call in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 125 | call . . . . . . . . . . . . in ''
| 342 | doCall in org.codehaus.groovy.grails.plugins.web.GroovyPagesGrailsPlugin$_closure5
| -2 | invoke0 . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke in ''
| 43 | invoke . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke in java.lang.reflect.Method
| 1426 | jlrMethodInvoke . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
| 93 | invoke in org.codehaus.groovy.reflection.CachedMethod
| 325 | doMethodInvoke . . . . . . . in groovy.lang.MetaMethod
| 1210 | invokeMethod in groovy.lang.MetaClassImpl
| 1123 | invokeMethod . . . . . . . . in groovy.lang.ExpandoMetaClass
| 1019 | invokeMethod in groovy.lang.MetaClassImpl
| 426 | call . . . . . . . . . . . . in groovy.lang.Closure
| 767 | invokeOnChangeListener in org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin
| 716 | notifyOfEvent . . . . . . . in ''
| 731 | notifyOfEvent in ''
| 408 | informOfClassChange . . . . in org.codehaus.groovy.grails.plugins.AbstractGrailsPluginManager
| 366 | informOfFileChange in ''
| 226 | informPluginManager . . . . in org.codehaus.groovy.grails.project.compiler.GrailsProjectWatcher
| 48 | access$400 in ''
| 152 | onNew . . . . . . . . . . . in org.codehaus.groovy.grails.project.compiler.GrailsProjectWatcher$1
| 76 | fireOnNew in org.codehaus.groovy.grails.compiler.AbstractDirectoryWatcher
| 104 | run . . . . . . . . . . . . in org.codehaus.groovy.grails.compiler.WatchServiceDirectoryWatcher
| 154 | run in org.codehaus.groovy.grails.compiler.DirectoryWatcher
^ 161 | run . . . . . . . . . . . . in org.codehaus.groovy.grails.project.compiler.GrailsProjectWatcher
I investigated a bit and found the following JIRA which says that this error was fixed since grails 2.3.3. I´ll be working extensively with taglibs, and having to restart the app every time I make a change is very time consuming.
Is there an override I could do in in resources.groovy? Is this error present in grails 2.5.3 or 2.5.1?
Good day and thanks.

Grails 2.4.4 - hibernate exception

when processing request: [GET] /sample/login/doLog the following error occour.
There is no column like email_Address in my db. but its says Unknown column 'user0_.email_address'
please help me guys.
Thanks in advance
/**LoginController.groovy **/
package sample
import grails.converters.JSON
class LoginController {
LoginService loginService
def doLog() {
def res = loginService.doLogin1();
render res as JSON
}
}
/** LoginService **/
package sample
import grails.transaction.Transactional
import sample.User
#Transactional
class LoginService {
def doLogin1() {
def result = User.executeQuery("from User")
return result
}
}
/** Domain class User.groovy **/
package sample
class User {
String emailAddress
String userPasswd
String payrollId
String posLoginId
String firstName
String lastName
String designation
static mapping = {
id name: "emailAddress", generator: "assigned"
version false
}
static constraints = {
emailAddress maxSize: 45
userPasswd maxSize: 45
payrollId nullable: true, maxSize: 20
posLoginId nullable: true, maxSize: 10
firstName maxSize: 45
lastName nullable: true, maxSize: 45
designation nullable: true, maxSize: 50
}
}
Error |
2015-10-24 17:46:27,431 [http-bio-8080-exec-1] ERROR util.JDBCExceptionReporter - Unknown column 'user0_.email_address' in 'field list'
Error |
2015-10-24 17:46:27,493 [http-bio-8080-exec-1] ERROR errors.GrailsExceptionResolver - MySQLSyntaxErrorException occurred when processing request: [GET] /sample/login/doLog
Unknown column 'user0_.email_address' in 'field list'. Stacktrace follows:
Message: Unknown column 'user0_.email_address' in 'field list'
Line | Method
->> -2 | newInstance0 in sun.reflect.NativeConstructorAccessorImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 57 | newInstance in ''
| 45 | newInstance . . . . . . . . . . . . . in sun.reflect.DelegatingConstructorAccessorImpl
| 526 | newInstance in java.lang.reflect.Constructor
| 1002 | jlrConstructorNewInstance . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
| 377 | handleNewInstance in com.mysql.jdbc.Util
| 360 | getInstance . . . . . . . . . . . . . in ''
| 978 | createSQLException in com.mysql.jdbc.SQLError
| 3887 | checkErrorPacket . . . . . . . . . . . in com.mysql.jdbc.MysqlIO
| 3823 | checkErrorPacket in ''
| 2435 | sendCommand . . . . . . . . . . . . . in ''
| 2582 | sqlQueryDirect in ''
| 2530 | execSQL . . . . . . . . . . . . . . . in com.mysql.jdbc.ConnectionImpl
| 1907 | executeInternal in com.mysql.jdbc.PreparedStatement
| 2030 | executeQuery . . . . . . . . . . . . . in ''
| 208 | getResultSet in org.hibernate.jdbc.AbstractBatcher
| 1953 | getResultSet . . . . . . . . . . . . . in org.hibernate.loader.Loader
| 802 | doQuery in ''
| 274 | doQueryAndInitializeNonLazyCollections in ''
| 2542 | doList in ''
| 2276 | listIgnoreQueryCache . . . . . . . . . in ''
| 2271 | list in ''
| 459 | list . . . . . . . . . . . . . . . . . in org.hibernate.loader.hql.QueryLoader
| 365 | list in org.hibernate.hql.ast.QueryTranslatorImpl
| 196 | performList . . . . . . . . . . . . . in org.hibernate.engine.query.HQLQueryPlan
| 1268 | list in org.hibernate.impl.SessionImpl
| 102 | list . . . . . . . . . . . . . . . . . in org.hibernate.impl.QueryImpl
| 150 | doInHibernate in org.codehaus.groovy.grails.orm.hibernate.metaclass.ExecuteQueryPersistentMethod$1
| 411 | doExecute . . . . . . . . . . . . . . in org.springframework.orm.hibernate3.HibernateTemplate
| 348 | executeFind in ''
| 88 | doInvokeInternal . . . . . . . . . . . in org.codehaus.groovy.grails.orm.hibernate.metaclass.ExecuteQueryPersistentMethod
| 79 | invoke in org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractStaticPersistentMethod
| 72 | invoke . . . . . . . . . . . . . . . . in ''
| 512 | executeQuery in org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi
| -1 | executeQuery . . . . . . . . . . . . . in sample.User
| 25 | $tt__doLogin1 in sample.LoginService
| -1 | doCall . . . . . . . . . . . . . . . . in eit.nvts.LoginService$_doLogin1_closure3
| -2 | invoke0 in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke . . . . . . . . . . . . . . . . in ''
| 43 | invoke in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke . . . . . . . . . . . . . . . . in java.lang.reflect.Method
| 1270 | jlrMethodInvoke in org.springsource.loaded.ri.ReflectiveInterceptor
| 90 | invoke . . . . . . . . . . . . . . . . in org.codehaus.groovy.reflection.CachedMethod
| 324 | doMethodInvoke in groovy.lang.MetaMethod
| 1207 | invokeMethod . . . . . . . . . . . . . in groovy.lang.MetaClassImpl
| 1110 | invokeMethod in groovy.lang.ExpandoMetaClass
| 1016 | invokeMethod . . . . . . . . . . . . . in groovy.lang.MetaClassImpl
| 423 | call in groovy.lang.Closure
| -1 | call . . . . . . . . . . . . . . . . . in eit.nvts.LoginService$_doLogin1_closure3
| 439 | call in groovy.lang.Closure
| -1 | call . . . . . . . . . . . . . . . . . in eit.nvts.LoginService$_doLogin1_closure3
| 88 | doInTransaction in org.codehaus.groovy.grails.orm.support.GrailsTransactionTemplate$2
| 133 | execute . . . . . . . . . . . . . . . in org.springframework.transaction.support.TransactionTemplate
| 85 | execute in org.codehaus.groovy.grails.orm.support.GrailsTransactionTemplate
| -1 | doLogin1 . . . . . . . . . . . . . . . in eit.nvts.LoginService
| 20 | doLog in eit.nvts.LoginController
| -2 | invoke0 . . . . . . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke in ''
| 43 | invoke . . . . . . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke in java.lang.reflect.Method
| 1270 | jlrMethodInvoke . . . . . . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
| 154 | invoke in org.codehaus.groovy.grails.web.servlet.mvc.MixedGrailsControllerHelper
| 375 | handleAction . . . . . . . . . . . . . in org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper
| 252 | executeAction in ''
| 205 | handleURI . . . . . . . . . . . . . . in ''
| 126 | handleURI in ''
| 72 | handleRequest . . . . . . . . . . . . in org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController
| 50 | handle in org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter
| 347 | doDispatch . . . . . . . . . . . . . . in org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet
| 870 | doService in org.springframework.web.servlet.DispatcherServlet
| 961 | processRequest . . . . . . . . . . . . in org.springframework.web.servlet.FrameworkServlet
| 852 | doGet in ''
| 620 | service . . . . . . . . . . . . . . . in javax.servlet.http.HttpServlet
| 837 | service in org.springframework.web.servlet.FrameworkServlet
| 727 | service . . . . . . . . . . . . . . . in javax.servlet.http.HttpServlet
| 303 | internalDoFilter in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter . . . . . . . . . . . . . . . in ''
| 52 | doFilter in org.apache.tomcat.websocket.server.WsFilter
| 241 | internalDoFilter . . . . . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 198 | doFilter . . . . . . . . . . . . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 344 | invokeDelegate . . . . . . . . . . . . in org.springframework.web.filter.DelegatingFilterProxy
| 261 | doFilter in ''
| 241 | internalDoFilter . . . . . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 101 | doFilter . . . . . . . . . . . . . . . in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter . . . . . . . . . . . . . . . in ''
| 101 | doFilter in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter . . . . . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 101 | doFilter . . . . . . . . . . . . . . . in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter . . . . . . . . . . . . . . . in ''
| 748 | invoke in org.apache.catalina.core.ApplicationDispatcher
| 486 | processRequest . . . . . . . . . . . . in ''
| 411 | doForward in ''
| 338 | forward . . . . . . . . . . . . . . . in ''
| 178 | forwardRequestForUrlMappingInfo in org.codehaus.groovy.grails.web.mapping.UrlMappingUtils
| 144 | forwardRequestForUrlMappingInfo . . . in ''
| 135 | forwardRequestForUrlMappingInfo in ''
| 216 | doFilterInternal . . . . . . . . . . . in org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter
| 107 | doFilter in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter . . . . . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 69 | doFilterInternal . . . . . . . . . . . in org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter
| 107 | doFilter in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter . . . . . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 67 | doFilterInternal . . . . . . . . . . . in org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter
| 107 | doFilter in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter . . . . . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 88 | doFilterInternal . . . . . . . . . . . in org.springframework.web.filter.CharacterEncodingFilter
| 107 | doFilter in org.springframework.web.filter.OncePerRequestFilter
| 344 | invokeDelegate . . . . . . . . . . . . in org.springframework.web.filter.DelegatingFilterProxy
| 261 | doFilter in ''
| 241 | internalDoFilter . . . . . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 220 | invoke . . . . . . . . . . . . . . . . in org.apache.catalina.core.StandardWrapperValve
| 122 | invoke in org.apache.catalina.core.StandardContextValve
| 171 | invoke . . . . . . . . . . . . . . . . in org.apache.catalina.core.StandardHostValve
| 103 | invoke in org.apache.catalina.valves.ErrorReportValve
| 116 | invoke . . . . . . . . . . . . . . . . in org.apache.catalina.core.StandardEngineValve
| 408 | service in org.apache.catalina.connector.CoyoteAdapter
| 1070 | process . . . . . . . . . . . . . . . in org.apache.coyote.http11.AbstractHttp11Processor
| 611 | process in org.apache.coyote.AbstractProtocol$AbstractConnectionHandler
| 314 | run . . . . . . . . . . . . . . . . . in org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
| 61 | run in org.apache.tomcat.util.threads.TaskThread$WrappingRunnable
^ 745 | run . . . . . . . . . . . . . . . . . in java.lang.Thread
There is no column like email_Address in my db. but its says Unknown
column 'user0_.email_address'
You just described what the exact problem is. You appear to have added an emailAddress field to your domain object, so Hibernate is expecting there to be an email_address column on the table now. You need to update your database schema somehow to match your domain objects.
You might want to look into the Grails Database Migration plugin.

Grails: CLI interaction while application is running

Is there anything bad about interacting with Grails via command line while an application is running? For example, I had an application running on my local machine via the grails run-app target and then I opened another command prompt and created a domain class, I noticed that it created the domain class and the equivalent test class but in the other terminal where I had the application running I got a fair bit amount of red text like this:
| Error 2015-03-01 10:40:10,392 [Thread-10] ERROR plugins.AbstractGrailsPluginManager
- Plugin [domainClass:2.3.8] could not reload changes to file [C:\Users\user\Dropbo
x\MoeStuff\Projects\qotd\grails-app\domain\qotd\Quote.groovy]: Ambiguous method overl
oading for method grails.spring.BeanBuilder#registerBeans.
Cannot resolve which method to invoke for [null] due to overlapping prototypes betwee
n:
[interface org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfigurati
on]
[interface org.springframework.beans.factory.support.BeanDefinitionRegistry]
Message: Ambiguous method overloading for method grails.spring.BeanBuilder#registerBe
ans.
Cannot resolve which method to invoke for [null] due to overlapping prototypes betwee
n:
[interface org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfigurati
on]
[interface org.springframework.beans.factory.support.BeanDefinitionRegistry]
Line | Method
->> 3034 | chooseMostSpecificParams in groovy.lang.MetaClassImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 2986 | chooseMethodInternal in ''
| 2929 | chooseMethod . . . . . . . . in ''
| 1204 | getMethodWithCachingInternal in ''
| 3163 | createPogoCallSite . . . . . in ''
| 1306 | createPogoCallSite in groovy.lang.ExpandoMetaClass
| 147 | createPogoSite . . . . . . . in org.codehaus.groovy.runtime.callsite.CallS
iteArray
| 161 | createCallSite in ''
| 45 | defaultCall . . . . . . . . in ''
| 108 | call in org.codehaus.groovy.runtime.callsite.Abstr
actCallSite
| 116 | call . . . . . . . . . . . . in ''
| 156 | doCall in org.codehaus.groovy.grails.plugins.DomainC
lassGrailsPlugin$_closure3
| -2 | invoke0 . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke in ''
| 43 | invoke . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke in java.lang.reflect.Method
| 1254 | jlrMethodInvoke . . . . . . in org.springsource.loaded.ri.ReflectiveInter
ceptor
| 90 | invoke in org.codehaus.groovy.reflection.CachedMetho
d
| 233 | doMethodInvoke . . . . . . . in groovy.lang.MetaMethod
| 1086 | invokeMethod in groovy.lang.MetaClassImpl
| 1110 | invokeMethod . . . . . . . . in groovy.lang.ExpandoMetaClass
| 910 | invokeMethod in groovy.lang.MetaClassImpl
| 411 | call . . . . . . . . . . . . in groovy.lang.Closure
| 767 | invokeOnChangeListener in org.codehaus.groovy.grails.plugins.Default
GrailsPlugin
| 716 | notifyOfEvent . . . . . . . in ''
| 731 | notifyOfEvent in ''
| 409 | informOfClassChange . . . . in org.codehaus.groovy.grails.plugins.Abstrac
tGrailsPluginManager
| 367 | informOfFileChange in ''
| 243 | informPluginManager . . . . in org.codehaus.groovy.grails.compiler.Grails
ProjectWatcher
| 46 | access$400 in ''
| 169 | onNew . . . . . . . . . . . in org.codehaus.groovy.grails.compiler.Grails
ProjectWatcher$1
| 210 | cacheFilesForDirectory in org.codehaus.groovy.grails.compiler.Direct
oryWatcher
| 204 | cacheFilesForDirectory . . . in ''
| 187 | checkForNewFiles in ''
| 163 | run . . . . . . . . . . . . in ''
^ 178 | run in org.codehaus.groovy.grails.compiler.Grails
ProjectWatcher
Can anyone please talk a bit about what this error(s) means? And is it ok to be doing what I was doing in the first place or should I ALWAYS stop an application from running before issuing any commands to grails that have to do with artefact creation/modification or do CLI interaction with Grails? Thanks.
It's a best practice to stop your application when doing artifact creation. Modification you can usually get away with keeping the application running, so long as you aren't doing major modifications to the class hierarchy.
The reason for this is in development mode Grails watches for changes artifacts and attempts to reload those changes. In the case of creation it may hit just at the wrong time and confuse your application (what you are seeing in your question).
Reloading of changed/new resources (Domain classes in particular) isn't perfect, but it works most of the time. Save yourself the headache and stop your application during creation.
So grails is going to try compile and load changes to files. So what you are seeing here is grails tried to compile a file you modified or were in the process of modifying and it failed.
Now how well can grails load and compile changes is a somewhat hit or miss. It will load them, but sometimes it just doesn't work and the server needs to be rebooted. Also the amount of processor needed to watch files can be overloaded especially when you checkout new code while your server is running.
So does this harm anything? Well no it just may or may not work. Your server may not reflect changes or it may give you wrong responses than what the code says because it couldn't loaded that code. Changing domain objects could affect your database or persistence layer, but some changes may not be compatible with your DB so you'll have to stop it.

Find files starting with NULs

How do I efficiently find all the files in the system whose contents starts with \x0000000000 (5 NUL bytes)?
Tried to do the following
$ find . -type f -exec grep -m 1 -ovP "[^\x00]" {}
$ find . -type f -exec grep -m 1 -vP "^\00{5}" {}
but the first variant works only for all-NUL files, and the last one searches through the whole file, not only the first 5 bytes, which makes it very slow and gives many false positives.
Try this :
grep -r '^\\x0000000000' * | cut -d ":" -f 1

Resources