Removing PATTERN from txt without removing lines and general text formatting
Hi Everybody! First post! Totally noobie.
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
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?
Thank you!
Also, I was using append >> to create a completely new file with the result.
I'm pretty noob !
How do I add to that Thank count you guys have?
Hi AxeHandle,
In both of the file redirections:
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.
Hello.
I'm writing a script where every file you create will generate a md5sum and store it into a text file.
Say I create 2 files, it'll look like this in the text file:
d41d8cd98f00b204e9800998ecf8427e /helloworld/saystheman
d41d8cd98f00b204e9800998ecf8427e /helloworld/test
I... (3 Replies)
How do I remove line that do not contain text, but that do contain tabs?
I have tried the command
cat file | awk NF
but that doesn't work when the lines contain tabs (and spaces).
I have also tried:
cat file | sed '/^$/d' (9 Replies)
Hi all,
I didn't find anything that specifically answers this after searching for a bit, so please forgive me if this has been covered before.
I'm looking to delete all lines prior to the last occurrence of a string in a file or stream from within a shell script (bash.)
A bit of... (4 Replies)
I have an ugly conf file that has the string I'm interested in searching for in the middle of a block of code that's relevant, and I'm trying to find a way to remove that entire block based on the matched line.
I've googled for this problem, and most people helping are only interested in... (9 Replies)
Hi,
I'm trying to remove multiple lines of text based off a series of different words and output it to a new file
The document contains a ton of data but i want to delete any line that has the following
mx1.rr.biz.com or ns2.ri.biz.com
i tried using grep -v filename "mx1.rr.biz.com" >... (3 Replies)
Hello,
So I wanted to write a very simple script to remove some information from a text file and save it as something else.
For example I have a text file (let's call it txt) with three rows of numbers:
0 0 1 9 8 7 5 0 6 7 9
0 0 7 9 8 1 1 6 4 0 6
0 0 9 8 4 6 0 9 2 8 1
And I want to... (2 Replies)
I have several huge files wich contains oracle table creation scripts as follows:
I would need to remove the pattern colored in red above. Any sed/awk/pearl code will be of much help.
Thanks (2 Replies)
I have a text file with rows of information (it is basically a ls command information(o/p from ls command))
I need to remove the lines ending with a .cnt extension and keep the lines ending with .zip extension, how to accomplish this.
I also only need the date,size and name of the file from every... (2 Replies)
Here is my problem I'm hoping you guru's can help me figure out. I have a text file that contains comma delimited columns. What I'm looking to do is see if the 24th column on each row in the file contains a value (not null), and then write/append that line to a different file.
I've been... (4 Replies)