I tried grep -v '^$'
in Linux and that didn't work. This file came from a Windows file system.
相关问题
- React Native Inline style for multiple Text in sin
- How to change the first two uppercase characters o
- Is there a way to rotate text around (or inside) a
- Execute C program till Ctrl+C hit in the terminal
- Gulp BrowserSync showing “reloading browsers” in T
相关文章
- 放在input的text下文本一直出现一个/(即使还没输入任何值)是什么情况
- What's the difference between grep -r and -R
- Emacs/xterm color annoyance on Linux
- make GitX open via Terminal for the repo laying at
- Ruby grep with line number
- Rendering plain text through PHP
- Shell Removing Tabs/Spaces
- JSON.parse with newline [duplicate]
Tried hard but this seems to work (assuming
\r
is biting you here)You can remove blank line with this example:
egrep -v "^\s\s+"
egrep already do regex, and the \s is white space.
The + duplicates current pattern.
The ^ is for the start
grep pattern filename.txt | uniq
Running the code-
To understand more about how/why this works, I recommend reading up on regular expressions. http://www.regular-expressions.info/tutorial.html