By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,332 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,332 IT Pros & Developers. It's quick & easy.

Output following Command

P: 21
Hi All

I am using the following command to get the output like this
home1
pandadk
sandbox
odm
odm_daa
pub_odm_daa_test1
run

Expand|Select|Wrap|Line Numbers
  1. echo "/home1/pandadk/sandbox/odm/odm_daa/pub_odm_daa_test1/run"|awk '{split($0,a,"/"); for(i=1; i<=NF; i++) print a[i]}'
But it is returning me nothing.

Please advise.

Thanks
Dilip
Sep 15 '08 #1
Share this Question
Share on Google+
2 Replies

ashitpro
Expert 100+
P: 542
Hi,
Please look at your for loop...
What is 'NF' here?
Have you tried replacing 'NF' with some constant?
You would definitely get the answer.

Regards,
Ash
Sep 15 '08 #2

Expert 100+
P: 511
Expand|Select|Wrap|Line Numbers
  1. echo "/home1/pandadk/sandbox/odm/odm_daa/pub_odm_daa_test1/run" | tr "/" "\n"
  2.  
or
Expand|Select|Wrap|Line Numbers
  1.  echo "/home1/pandadk/sandbox/odm/odm_daa/pub_odm_daa_test1/run" | awk  '1' RS="/" 
  2.  
Sep 15 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.