I have a text log file
$ cat aaa
673 20160405 root "/path_to/gis/20160401/20160301_placement_map_org.dbf" ""
673 20160405 root "/path_to/gis/20160401/20160310_20160401ent_map_org.dbf" ""
790890 20170201 jle "/path_to/gis/20160401/Pina (Asc) 20160401 Rapid Report.kmz" ""
5883710 20160406 dho "/path_to/gis/20160401/20160401_Pina_Asc_Rapid_Report_Minesouth.pdf" ""
673 20160405 dho "/path_to/gis/20160401/20160310_20160401 placement map org.dbf" ""
Now I have this script output just the full path of the files:
#!/bin/bash
function nodatechk() {
arr=("$@")
for ((i=3;i<${#arr[@]};i+=5));
do
echo "${i}" "${arr[i]}"
done
}
r=( $(grep gis aaa) )
nodatechk "${r[@]}"
The output is break because of the 3rd line (and 5th line) have a space in the element, although it has double quote.
How can I fix this? (BTW I know I can use awk or cut to print out columns, but in this case I just want use grep.) Thanks.