Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I thought that awk without arguments is equivalent to awk {print} file.
But when I do:

awk '' file

Nothing is printed.

Why?

share|improve this question
    
Who said '' was nothing...? :p –  John WH Smith Jul 15 at 11:22

1 Answer 1

up vote 3 down vote accepted

Because in your case, awk evaluated a false condition, and no associated actions so it does nothing.

awk does default action print when a condition is true and no actions are specified,

Try:

awk 1 file
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.