![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Removing blank lines? How to eliminiate the blank lines from log file? Can it be done through regular expressions /^$/ Thanks, Nikhil |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Removing blank lines? > How to eliminiate the blank lines from log file? > Can it be done through regular expressions /^$/ There is a way I often see used but it doesn't work if some of the "empty lines" happen to have whitespace: PS > gc Test.txt | select-string . Here is a way that does seem to work: PS > gc Test.txt | ? { $_ -notmatch "^$|^\s+$" } One The next line is blank Two Next, a line that has three spaces and three tabs 3 987 654 ,%~` !@$!@#$ Five And this is the end. PS > gc Test.txt Mike |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Removing blank lines? "mikes.net" <michael.net@gmail.com> wrote in message news:1171547571.724191.316310@v45g2000cwv.googlegroups.com... >> How to eliminiate the blank lines from log file? >> Can it be done through regular expressions /^$/ > > Here is a way that does seem to work: > > PS > gc Test.txt | ? { $_ -notmatch "^$|^\s+$" } > One The next line is blank I think that the regex could be simplified to '^\s*$'. -- Keith |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Blank lines at top of reply | Joseph Meehan | Live Mail | 1 | 05-18-2008 12:53 PM |
| Blank lines at top of reply | Joseph Meehan | Live Mail | 0 | 03-28-2008 06:22 AM |
| Removing lines from a text file | Did | PowerShell | 3 | 03-15-2007 09:38 AM |
| removing first three lines in a text file | fixitchris | PowerShell | 2 | 11-17-2006 06:21 PM |
| editing subject lines and removing attachments | eric | Vista mail | 1 | 11-09-2006 09:17 PM |