My source file is tab delimited and I need to grep the 4th column of values. How can I do this in Groovy? Here’s my code which doesn’t work. Is it even close?
def tab_file = new File('source_file.tab')
tab_file.eachline { line -> println line.grep('\t\t\t\t'}
You could split by tab character, that would give you an array you can index into to get the column: