The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
adding semicolumn at end of line scorpio Shell Programming and Scripting 2 05-19-2008 05:47 AM
Adding a columnfrom a specifit line number to a specific line number Ezy Shell Programming and Scripting 2 05-12-2008 05:29 AM
sed - adding new line sovixi UNIX for Dummies Questions & Answers 2 10-09-2007 06:06 AM
adding line terminator thanuman UNIX for Dummies Questions & Answers 1 02-24-2005 04:53 AM
Stop exe from command line zing High Level Programming 2 07-21-2003 04:51 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-18-2006
Registered User
 

Join Date: Jun 2006
Posts: 2
Post Stop awk adding a new line

In a loop, I want to append some text to a file without generating a new line (and then force a new line before re-iterating the loop). In the code below the first 'echo' command is OK as it uses '--n' for no new line. For the 'awk' line I *thought* I could solve it by using printf rather than print (and not using the normal '\n').

The loop is as below:

do
echo -n $testTimeNow $'\t' >> $HOME/temp/ss.tmp
/usr/sbin/ss -i | awk -f awk_filter.tmp >> $HOME/temp/ss.tmp
# A new line now
echo "" >> $HOME/temp/ss.tmp
done


Note, awk_filter.tmp is ...

/[match]/ {printf "%s %s" \$1, \$2 }


but this isn't working. The 'awk' line in the loop *is* adding a new line in. Any and all suggestions appreciated!
Reply With Quote
Forum Sponsor
  #2  
Old 06-18-2006
Registered User
 

Join Date: Jun 2006
Posts: 2
Well, to answer my own question, the "printf" method *does* work - it only appeared not to work becuase I got awk_filter.tmp files mixed up and I was using the 'print' version not the 'printf' version!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0