I’m trying to pull a value out of a file. The problem is, the value can appear after either a tab or a space.
My simplified relevance so far is this:
following texts of first " " of lines whose (it contains “KEYWORD”) of file “/tmp/foo”
this works GREAT when there’s a space, but it doesn’t find a value that has a tab separating KEYWORD and the value
alternately, I can do
following texts of first “%09” of lines whose (it contains “KEYWORD”) of file “/tmp/foo”
and I find any lines which are separated by tabs. But it misses those that are separated by spaces.
Short of building a big old IF statement to see if the line is separated by tabs or spaces, and pulling the correct value in that event, is there a way to basically say:
following texts of first WHITESPACE of lines whose (it contains “KEYWORD”) of file “/tmp/foo”
concatenation of substrings separated by “%09” of following texts of first “KEYWORD” of (lines whose (it contains “KEYWORD”) of file “/tmp/foo”) as trimmed string
(if it starts with " " then following text of first " " of it else if it starts with “%09” then following text of first “%09” of it else nothing) of (lines whose ((it as string starts with " " AND it as string as lowercase contains “KEYWORD”) OR (it as string starts with “%09” AND it as string as lowercase contains “KEYWORD”)) of file “/tmp/foo”)