# sh reading line of log problem



## itchibahn (Dec 14, 2009)

I'm trying to read entire line into a variable, but seems the variable is returning each word.

The result I'm trying to get is
  "block in quick all group 100"
But the below code is giving me:
  "block"
  "in"
  "quick"
  "all"
  "group"
  "100"


```
#!/bin/sh
#
for rules in `ipfstat -i | grep "group 100"` ; do
     echo "$rules"
done
```


----------



## DutchDaemon (Dec 14, 2009)

What's wrong with


```
ipfstat -i | grep "group 100"
```

?


----------



## DutchDaemon (Dec 14, 2009)

If you really need a line-by-line approach:


```
ipfstat -i | grep "group 100" | while read line
do
echo ${line}
done
```

(this is a useless duplication though)


----------



## itchibahn (Dec 14, 2009)

DutchDaemon said:
			
		

> What's wrong with
> 
> 
> ```
> ...



Nothing wrong with that, I'm just trying to manipulate the string.


----------



## itchibahn (Dec 14, 2009)

DutchDaemon said:
			
		

> If you really need a line-by-line approach:
> 
> 
> ```
> ...



This works.  Exactly what I needed to manipulate each lines.
Thanks.


----------

