grep question
I have a large text file that has the following information in it. This is just a snippet of it:
Code:
3|9|JF HEN|| 1. edit out the double pipe " || " only at the end of the line and redirect that info to a new file. 2. Edit out any text only at the end of the line that is between a double pipe (example |#11| )and redirect that to a new file. |
Quote:
What reference do you use for scripting? I strongly recommend "Bash Guide for Beginners"---free at http://tldp.org To redirect something to a file, simply put this at the end of the command string: "> newfilename" There are several ways to grab a specific string, eg: grep -o string filename ##prints every occurrence of "string" To get only the text inside the last set of "|"s: sed -n 's/.*|\(.*\)|$/\1/p' filename (Actually, this syntax yields what is inside the last pair of "|"s at the end of the line.) To match something not at the end of the line, some more tweaks are required. |
All times are GMT -5. The time now is 04:56 AM. |