1

I have a problem in printing a column that has names starting with ` (tick).

Below is the content in my file.

abc xyz pqr sym = `WST" abc xyz pqr sym = `WTFC" abc xyz pqr sym = `WTI" abc xyz pqr sym = `WTM" abc xyz pqr sym = `WTR" 

I want to print anything after the third column and I'm using the below code:

awk '{{printf "\n"} for(j=4;j<NF;++j){printf " %s",$j}}' 

But,I'm not getting the expected output. Its not printing the last column. Could be because of tick character before the name. How can I make it to print the last column as well?

OUTPUT:

sym = sym = sym = sym = sym = 

EXPECTED OUTPUT:

sym = `WST" sym = `WTFC" sym = `WTI" sym = `WTM" sym = `WTR" 
1
  • Here is my command: awk '{{printf "\n"} for(j=4;j<NF;++j){printf " %s",$j}}' Commented Jan 3, 2014 at 17:49

1 Answer 1

2

It's because you're using j < NF instead of j <= NF

Since the field separator seems to be a single space, you could

cut -d " " -f 4- file 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.