I'm using the terminal to read a poorly formatted book.
The text file contains, in the middle of paragraphs, hyphenation to split words that are supposed to be on multiple pages. It looks ve -- ry much like this.
I was hoping to use
grep -v " -- " file.txt >> newfile.txt
to clean up the file, but, of course, grep removes whole lines.
How would you go about removing these tokens without removing the whole line?
And, people of the forum do you have any other tips and tricks for formatting text files for better viewing in the terminal without using a text editor?
if file did not exist beforehand, it will be created and the output written to standard output by command will be sent to file . If file did exist, the operator > will cause the current contents to be discarded before the data written by command is written to file while the operator >> will leave the current contents of file unchanged and will append the data written by command to the end of the previous contents of file .
In the bottom right corner of any post that you did not write and that you have not already thanked, there is a button with a hand with a thumb up and the word "Thanks". If you press that button, you will be adding your thanks to the person who submitted that post.
junior-helper,
The way I read the 1st post in this thread, I thought the hyphenation was added when a word was split across a page boundary in the original text of the book. I assumed that there wouldn't be more than one page break on a single line (so the g flag wouldn't be needed), but adding the g flag certainly wouldn't hurt.