I
I
Igor2014-03-14 15:42:47
linux
Igor, 2014-03-14 15:42:47

How to add a tab to awk '{print}'?

I'm looking for a pattern in a file, I need a tab or a space on the output to the line, I tried to add FS, OFS, maybe I made a mistake somewhere with the syntax.
How can I do if I use awk?
cat txt.txt | awk '/'$p'/{print}'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2014-03-14
@mmilky

You have a strange pattern: $p -- p after the end of the line. It doesn't match for me (:
You can use printf, formatting is like in C:
A book about awk: www.gnu.org/software/gawk/manual/gawk.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question