I have a text file with 50k lines like this
word1 1 23
word2 43 23
word3 197
word4
and need a way to make it look like this:
word1
word2
word3
word4
So I need a way to remove every character behind the first space in each line.
How do I do this?
Multiple solutions.
Solution 1: Vim
Open the file in vim, then run:
:%s/\s.*//gSolution 2: sed
sed "s/ .*//g" < input_file > output_fileCannot do this on windows tho.
Solution 3: Excel/Calc/Numbers
Import the file in OpenOffice/MSOffice/etc.
You can set space as a delimiter.
But this is a slower and less fun. 🙂