i'm trying to cut a string into the shell. I'd like to do something like:
cut -d' ' -f1 "hello 12345 xyz"
but the problem is that cut accept a file, so if i pass the string to it, it tries to open the unexistent file called "hello 12345 xyz" and then tries to cut its content
I'd like to resolve this problem with the base programs, so don't tell me to use awk
thanks!
You can use Here Strings
in BASH
:
cut -d' ' -f1 <<< "hello 12345 xyz"
hello