简体   繁体   中英

Batch - type command that skips empty lines

Is it possible to have the type command skip empty lines in a text file?

Or is there an alternate command that will print out the contents of a text file while skipping empty lines in that text file?

solution for sed for Windows

sed "/^$/d" file_with_empty_lines > file_without_empty_lines

or without external tools:

(for /f "usebackqdelims=" %%a in ("file_with_empty_lines") do echo(%%a)> file_without_empty_lines

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM