return all non-blank lines in a file(linux)

S

Stan

hi,

Could any one give me an advice of providing a regular expression that
will return all non-blank lines in a file in linux.
Maybe it is just a command!

Thanks

Stan
 
J

Jack Klein

hi,

Could any one give me an advice of providing a regular expression that
will return all non-blank lines in a file in linux.
Maybe it is just a command!

Thanks

Stan

Is this a question about programming in C? If not, you need a Linux
group.

Even if you want to write a C program to do this, your problem
statement is not detailed enough. What is your definition of a "blank
line"?
 
E

E. Robert Tisdale

Stan said:
Could any one give me an advice
of providing a regular expression
that will return all non-blank lines in a file in linux.
Maybe it is just a command!

1. To remove lines that begin with a newline character, try:

grep -v '^$' filename

2. Heed Jack Klein's advice and ask in a Linux newsgroup.
 
M

Mark Shelor

Stan said:
Could any one give me an advice of providing a regular expression that
will return all non-blank lines in a file in linux.
Maybe it is just a command!


$ grep -v ^$ filename
 
M

Mark McIntyre

$ grep -v ^$ filename

this doesn't compile. Nor is grep mentioned in the Standard.

IOW, don't answer offtopic posts here. If you are going to answer
offtopic posts, do it privately, and at the same time redirect the OP
to a more sensible place. You've been told this before, whats so hard
about it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top