-2

I am having trouble manipulating the text in the screenshot. I need to change the file so only the IP address in the last column are left. enter image description here

closed as unclear what you're asking by Jeff Schaller, G-Man, mdpc, Archemar, Wildcard Jan 27 '18 at 4:21

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

cut is a bit annoying in that even if you set the delimiter to a space, it takes all spaces as delimiters. It'll find a large bunch of empty fields in that input...

You could use cut -cN-M with appropriate values to pick a fixed-width field, or awk '{print $5}' to print the fifth field (awk takes multiple spaces as as one delimiter). Or you could use something like sed -e 's/^.*A[[:space:]]*//' to remove everything up to the (last) A, along with the following white space...

  • Thanks for the responses! I'll give them a try at work tomorrow. Sorry about the screenshot, but this is my first time on here. – Jason Estes Jan 25 '18 at 23:52
  • Thanks guys! The awk command worked very nicely for my needs. – Jason Estes Jan 31 '18 at 1:33
1

A simple awk command:

awk '{print $NF}' file

will print the last field ($NF) of the file.

Not the answer you're looking for? Browse other questions tagged or ask your own question.