Seeking assistance in Shell script

#!/bin/bash
>error_log
for s in `cat s.txt`
do
uptime $s >>error_log
echo $s >>error_log
done

The above code produce output with server name and its uptime in 2 different lines .My requirement is to have the same in one line . Please assist

#!/bin/bash
>error_log
for s in `cat s.txt`
do
echo $(uptime $s) $s >>error_log
done

Or neater as a single line:-

print "$(uptime) `cat s.txt`"  > error.log

...or...

( printf "$(uptime) \c" ; cat s.txt) > error.log

I hope that this helps,
Robin

thanks it helped and worked :b:.Please close this thread .