![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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! |
| Forum Sponsor | ||
|
|
|
#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!
|
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|