User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,429 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,626 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 1127 | Replies: 3
Reply
Join Date: Feb 2006
Posts: 15
Reputation: rusman is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
rusman rusman is offline Offline
Newbie Poster

Help awk output separators?

  #1  
Jun 20th, 2007
How can i get awk to separate the output with dashes?
A simple awk '{print $1-$2-$3}' does not work.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 1,509
Reputation: masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light 
Rep Power: 10
Solved Threads: 136
masijade's Avatar
masijade masijade is offline Offline
Posting Virtuoso

Re: awk output separators?

  #2  
Jun 21st, 2007
awk '{print $1 "-" $2 "-" $3}'
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Feb 2007
Posts: 52
Reputation: radoulov is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
radoulov's Avatar
radoulov radoulov is offline Offline
Junior Poster in Training

Re: awk output separators?

  #3  
Jun 21st, 2007
$ echo "a b c"|awk '$1=$1' OFS="-"
a-b-c

$ echo "a b c"|awk '{print $1,$3}' OFS="-"
a-c
Last edited by radoulov : Jun 21st, 2007 at 11:01 am. Reason: Addition
Reply With Quote  
Join Date: Feb 2006
Posts: 15
Reputation: rusman is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
rusman rusman is offline Offline
Newbie Poster

Re: awk output separators?

  #4  
Jun 21st, 2007
Got it working, thanks very much, as always
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 1:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC