I want to get the first word in every line from a file. Unfortunately a lot of lines begin with space(s). So I try to get the firs word with the following:
awk -F'[ \t]+' '{print $1}' < MyFile.txt
, but it's not working. I try this echo " some string: here" | awk -F'[ \t]+' '{print $1}'
and the results is blank line (I thing that it prints empty string). So why this is not working? I want to make it works with the awk command and explicitly passed delimiter (with educational purposes)
Thanks in advance.
echo " some string: here" | awk '{print $1}'