I have the following file:
…
LINK=dummy 172.17.100 => 10.218.11 [PATH=/etc]
FILE=hosts 172.17.100 => 10.218.11 [PATH=/etc]
FILE=network 172.17.100 => 10.218.11 [PATH=/etc/sysconfig]
LINK=empty 172.17.100 => 10.218.11 [PATH=/etc]
FILE#TEST 172.17.100 => 10.218.11 [PATH=/etc/sysconfig]
…
How to print the first field and the fifth field only if line start with the word FILE
?
The word FILE
could be located immediately in the begging of line or after space or TAB in the line.
Example of what I expected to get
FILE=hosts [PATH=/etc]
FILE=network [PATH=/etc/sysconfig]
FILE#TEST [PATH=/etc/sysconfig]
I try this awk but doesn't work
awk '$1 == "^[[:blank:]]*FILE*" && '{print $1" "$5}' file