I have a text file on Linux where the contents are like below:
help.helloworld.com:latest.world.com
dev.helloworld.com:latest.world.com
I want to get the contents before the colon like below:
help.helloworld.com
dev.helloworld.com
How can I do that within the terminal?
grep
utility is used for looking for lines matching regular expressions. You could possibly use it here, but it would be more appropriate to use a tool that extracts data from fields given some delimiter, such as thecut
utility. – Kusalananda Aug 27 '19 at 17:23grep
is the right tool to solve the actual problem. – Monty Harder Aug 28 '19 at 18:21