943,724 Members | Top Members by Rank

Ad:
Jun 20th, 2007
0

awk output separators?

Expand Post »
How can i get awk to separate the output with dashes?
A simple awk '{print $1-$2-$3}' does not work.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rusman is offline Offline
17 posts
since Feb 2006
Jun 21st, 2007
0

Re: awk output separators?

Shell Scripting Syntax (Toggle Plain Text)
  1. awk '{print $1 "-" $2 "-" $3}'
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006
Jun 21st, 2007
0

Re: awk output separators?

Shell Scripting Syntax (Toggle Plain Text)
  1. $ echo "a b c"|awk '$1=$1' OFS="-"
  2. a-b-c

Shell Scripting Syntax (Toggle Plain Text)
  1. $ echo "a b c"|awk '{print $1,$3}' OFS="-"
  2. a-c
Last edited by radoulov; Jun 21st, 2007 at 11:01 am. Reason: Addition
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
radoulov is offline Offline
54 posts
since Feb 2007
Jun 21st, 2007
0

Re: awk output separators?

Got it working, thanks very much, as always
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rusman is offline Offline
17 posts
since Feb 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: read line is stripping leading spaces
Next Thread in Shell Scripting Forum Timeline: Description for non 0 Exit codes in detail





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC