Posted: 9/17/2010 2:58:15 PM EDT
|
Is there a | begin command for Grep.
Like grep | begin <–– ??? Want to search for a particular string and then everything past it. Thanks, |
|
in addition to what has been posted above, i encourage you to explore sed and awk. a trivial relationship with sed leads to all kinds of neat operations on text files –– such as the one you are looking for. that said, REGEX is a theme, common with grep, vi, etc. behold: http://sed.sourceforge.net/sed1line.txt # print section of file from regular expression to end of file sed -n '/regexp/,$p' i can't tell you how many times i have used the following, # remove most HTML tags (accommodates multiple-line tags) sed -e :a -e 's/<[^>]*>//g;/</N;//ba' to screen scrape some data from a piece of network equipment with a GUI interface. also see http://www.pement.org/awk/awk1line.txt and be sure to google "sed one liners explained" and/or "awk one liners explained". have fun. ar-jedi |
|
Regular expressions are your friend...
Then you can get into sed and awk and do some amazing shit. I'm still pretty green when it comes to regex, but I know enough to be dangerous. Of course, you can always use grep begin /path/to/file and it will show you every line that has 'begin' on it. |