Using Awk specify Unusual Delimiter

# echo "size(JFJF" |  awk -F"size(" '{print $1}'
awk: fatal: Unmatched ( or \(: /size(/

the delimiter is "size(" but i'm not sure if awk is the best tool to use to specify it.

i have tried:

# echo "size(JFJF" |  awk -F"size\(" '{print $1}'
awk: warning: escape sequence `\(' treated as plain `('
awk: fatal: Unmatched ( or \(: /size(/

any ideas?

Are you trying to print JFJF...in that case try this

echo "size(JFJF" |  awk '{FS="size\("; print $2}'

Or escape the backlash properly...

echo "size(JFJF" |  awk -F"size\\\(" '{print $2}'
1 Like