I have a log file that contains several lines, each with an IP, username, and URL. I need to create something that will take each IP in the line and, if starting with a 10 will append the word "ON" to the end of the line containing it. All other lines with any other IP not starting with a 10 will need to have the word "OFF" appended to it.
Example of log file:
10.10.10.10 jsmith1234 [URL]
173.10.10.10 jsmith1234 [URL]
Example of what I want:
10.10.10.10 jsmith1234 [URL] ON
173.10.10.10 jsmith1234 [URL] OFF
I believe an if, then, else statement would work (used in a bash shell script), but I am very new to these and not sure where to start.
awk
orsed
is what you want. What have you tried so far? – MatthewRock Jun 10 at 13:29