Replace commas with spaces using "cut"
             admin
 20 July 2009            
    
  # echo "test,test,test" | cut -d',' --output-delimiter=' ' -f1-
test test test
- Read more about Replace commas with spaces using "cut"
 - Log in to post comments
 
Bash loop with End of Line as delimiter
             admin
 20 July 2009            
    
  Here is how you do a for loop that uses the end of the line as the delimiter instead of space delimited.
The reason this is better is that you can set variable inside the loop and check them outside unlike doing it with a while read loop.
The testfile.data file can now have spaces on each line.
#!/bin/sh
IFS="
"
for i in `cat testfile.dat`
do
        CHECK="test"
        echo $i
done
echo ${CHECK}
- Read more about Bash loop with End of Line as delimiter
 - Log in to post comments