The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 06-27-2006
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
While we're at it, another way:

Code:
#! /bin/bash

while read line; do
 [[ $line == ,* ]] && {
  printf "%s" "$line"
 } || {
  printf "\n%s" "$line"
}
done; printf "\n"

Accepts redirects and input from pipe, as does most of the others. I have to say, I like the sed example above. Pretty nifty...