Extract pattern from text line

Hi,

the text line looks like this:

"test1" " " "test2" "test3" "test4" "10" "test 10 12" "00:05:58" "filename.bin" "3.3MB" "/dir/name" "18459"

what's the best way to select any of it? So I can for example get only the time or size and so on.

I was trying awk -F""" '{print $N}' but that didn't work.

field=4
awk FS '("| )' -v fld=$field '{print $fld}' inputfilename

You can have several different field sep. The default is tab/space.

What you want to select? For the last column use $(NF-1) variable

awk -F\" {print $(NF-1)}' file

I just need a way to extract for example the time or size or dir name from the text line.

so I can use it like:

echo "test1" " " "test2" "test3" "test4" "10" "test 10 12" "00:05:58" "filename.bin" "3.3MB" "/dir/name" "18459" | awk or whatever

and as output get 00:05:58 or 18459 and so on